from:http://www.raincat.net/blog/showlog.asp?cat_id=6&log_id=428
示例:
SQL> update tb_test_log a
2 set game_deal_log_id = (select game_deal_log_id
3 from test b
4 where a.table_id = b.table_id);
上述多表联合更新时,有时会报“ORA-01407: cannot update to null”错误,原因系存在表间关联不到的记录(null)。
解决方法:
SQL> update tb_test_log a 2 set game_deal_log_id = (select game_deal_log_id 3 from test b 4 where a.table_id = b.table_id) 5 where exists (select 1 from test b where a.table_id=b.table_id);