Oracle 错误 ORA-00971
我在针对 oracle 10g (10.2.0.1.0) 运行以下 SQL 时遇到错误:
UPDATE fx_datumvcompgeneric AS c
SET mp = (SELECT p.mp
FROM fx_propertyattrsingletscomp AS p
WHERE c.var_container = p.id
)
WHERE c.mp IS NULL
错误是:ORA-00971:缺少 SET 关键字
我们通过 JDBC 执行此操作,顶部异常堆栈的内容是:
java.sql.SQLException: ORA-00971: missing SET keyword
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)
oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:207)
oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:957)
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1170)
oracle.jdbc.driver.OracleStatement.executeUpdateInternal(OracleStatement.java:1623)
oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:1588)
org.apache.commons.dbcp.DelegatingStatement.executeUpdate(DelegatingStatement.java:225)
org.apache.commons.dbcp.DelegatingStatement.executeUpdate(DelegatingStatement.java:225)
I'm getting an error when running the following SQL against oracle 10g (10.2.0.1.0):
UPDATE fx_datumvcompgeneric AS c
SET mp = (SELECT p.mp
FROM fx_propertyattrsingletscomp AS p
WHERE c.var_container = p.id
)
WHERE c.mp IS NULL
The error is: ORA-00971: missing SET keyword
We're doing this through JDBC, the top of the exception stack is:
java.sql.SQLException: ORA-00971: missing SET keyword
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)
oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:207)
oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:957)
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1170)
oracle.jdbc.driver.OracleStatement.executeUpdateInternal(OracleStatement.java:1623)
oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:1588)
org.apache.commons.dbcp.DelegatingStatement.executeUpdate(DelegatingStatement.java:225)
org.apache.commons.dbcp.DelegatingStatement.executeUpdate(DelegatingStatement.java:225)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
去掉两个 AS 关键字 - Oracle 不喜欢它们。
Get rid of both AS keywords - Oracle doesn't like them here.
您无法在更新中为表添加
AS
别名You can't alias a table with
AS
in an update只需删除 AS: http://download.oracle.com/docs/cd/B12037_01/appdev.101/b10807/13_elems053.htm
Just remove AS: http://download.oracle.com/docs/cd/B12037_01/appdev.101/b10807/13_elems053.htm