在ORACLE SQL Developer上运行时,给定查询执行正常。但是在通过java代码执行时抛出ORA-00923: FROM keyword not found where expected
。
UPDATE RESTRICTED_MARKET_OWNER
SET OWNER_ID='abc'
WHERE OWNER_ID='xyz' AND RESTRICTED_MARKET_ID IN
(
SELECT M.RESTRICTED_MARKET_ID
FROM RESTRICTED_MARKET M, RESTRICTED_MARKET_OWNER RM
WHERE RM.RESTRICTED_MARKET_ID = M.RESTRICTED_MARKET_ID AND
M.RELEASE='Rel123' AND RM.OWNER_ID='xyz'
)
关于此
的任何建议Java查询
UPDATE RESTRICTED_MARKET_OWNER SET OWNER_ID=? WHERE OWNER_ID=? AND RESTRICTED_MARKET_ID IN ( SELECT M.RESTRICTED_MARKET_IDFROM RESTRICTED_MARKET M , RESTRICTED_MARKET_OWNER RM WHERE RM.RESTRICTED_MARKET_ID=M.RESTRICTED_MARKET_ID AND M.RELEASE=? AND RM.OWNER_ID=? )
pstmt.setString(1, 'abc');
pstmt.setString(2, 'xyz');
pstmt.setString(3, 'Rel123');
pstmt.setString(4, 'xyz');
pstmt.executeUpdate();
答案 0 :(得分:1)
在Java查询中似乎是一个拼写错误,表名与FROM
关键字之间缺少空格:
SELECT M.RESTRICTED_MARKET_IDFROM RESTRICTED_MARKET M.
因此,更正语法将使您的查询正常工作。