Oracle 基于另一个表中的列更新列
为什么我的update语句会说“不能在gitb\u auto\u debit\u upload.status中插入null”。第二个查询返回一条记录,其中列process_status的值为“P”Oracle 基于另一个表中的列更新列,oracle,Oracle,为什么我的update语句会说“不能在gitb\u auto\u debit\u upload.status中插入null”。第二个查询返回一条记录,其中列process_status的值为“P” Update gitb_auto_debit_upload a set status = (select nvl(process_status,'O') from gitb_daily_log b where b.interface_code
Update gitb_auto_debit_upload a
set status = (select nvl(process_status,'O') from gitb_daily_log b
where b.interface_code = 'PHP661OW'
and b. process_ref_no = '4708'
and a.refno = b.external_ref_no
and a.recordno = b. seq_no
) ;
select * from gitb_auto_debit_upload a, gitb_daily_log b where b.interface_code = 'PHP661OW'
and b. process_ref_no = '4708'
and a.refno = b.external_ref_no
and a. recordno = b. seq_no
错误消息来自gitb_auto_debit_upload中的一条记录,select(update中的一条)语句不返回任何行 您的update语句处理gitb_auto_debit_upload的所有记录。 您的select(用于测试状态值的语句)语句仅用于gitb_daily_日志中存在记录的记录
您需要将update语句更改为仅更新select返回的行,或将NVL()放在select的周围。谢谢。我现在明白了。