ORA-01407 错误解决

来源:互联网 发布:照片合成用什么软件 编辑:程序博客网 时间:2024/05/09 02:10

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);

 

 

 

 

 

 

 

 

原创粉丝点击