0
UPDATE table1
SET
table1.field1 = table2.field1,
table1.field2 = table2.field2,
table1.field3 = table2.field3,
table1.fieldn = table2.fieldn
JOIN
table1 ON table2.joinfield = table1.joinfield

我在 Oracle (Toad for Oracle) 中遇到错误:ORA-00933: SQL 命令未正确结束

4

1 回答 1

0

这可以通过MERGE语法来解决:

merge into table1 t1 
using ( 
  select field1, field2, field3, joinfield
  from table2
  where table2.field1 = 0
) merge_set
on (
  t1.joinfield = merge_set.joinfield 
)
when matched then update
  set 
    t1.field1 = merge_set.field1,
    t1.field2 = merge_set.field2,
    t1.field3 = merge_set.field3

SQLFiddle 示例

另外,请查看@Ben 在评论中提供的参考 问题。

于 2013-06-10T22:10:59.667 回答