在针对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: missing SET keyword
我们通过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)
答案 0 :(得分:5)
摆脱两个AS关键字 - Oracle在这里不喜欢它们。
答案 1 :(得分:1)
您无法在更新
中为AS
的别名设置别名
答案 2 :(得分:1)