当我尝试使用以下语法更新两个表时,我收到以下错误:
从命令行第20行开始出错:
UPDATE
tableA t1,
tableAClone t2
SET
t1.SECTION_ID = t2.SECTION_ID
WHERE
t1.CATEGORY_id = t2.CATEGORY_id
命令行出错:21列:30 错误报告: SQL错误:ORA-00971:缺少SET关键字 00971. 00000 - “缺少SET关键字” *原因:
*操作:
UPDATE
tableA t1,
tableAClone t2
SET
t1.SECTION_ID = t2.SECTION_ID
WHERE
t1.CATEGORY_id = t2.CATEGORY_id;
答案 0 :(得分:2)
你的sintax在使用
的oracle尝试中无效 UPDATE tableA
SET tableA.SECTION_ID = (
SELECT tableAClone.SECTION_ID
FROM tableAClone
WHERE tableA.CATEGORY_id = tableAClone.CATEGORY_id
)
WHERE EXISTS (
SELECT tableAClone.SECTION_ID
FROM table2
WHERE tableA.CATEGORY_id = tableAClone.CATEGORY_id
)
;