Oracle Update时,如果需要同时更新多个字段时,一定要严格谨慎!
例如:
Update table1 a set (c1,c2,c3)=(select c1,c2,c3 from table2 b where a.id=b.id)
where exists (select 1 from table2 where id=a.id);
要加上后面的where 条件,以保证数据能够完全匹配,从而确保数据能够正确、顺利的更新完成!
例如:
Update table1 a set (c1,c2,c3)=(select c1,c2,c3 from table2 b where a.id=b.id)
where exists (select 1 from table2 where id=a.id);
要加上后面的where 条件,以保证数据能够完全匹配,从而确保数据能够正确、顺利的更新完成!
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7925783/viewspace-1572091/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/7925783/viewspace-1572091/