SQL命令和语句中缺少逗号被忽略

时间:2014-06-29 11:08:50

标签: sql oracle

我从这个触发器中遇到问题

create or replace trigger HAPUS_PENDUDUK 
after delete on system.PENDUDUK
for each row
BEGIN
  insert into penduduk_backup values (
     old_nip , old_nama, nama_user, tanggal_perubahan || old: nip, old: nama,
     current_user, sysdate()
  );
END;

运行后写道:

Error(5,3): PL/SQL: SQL Statement ignored
Error(5,94): PL/SQL: ORA-00917: missing comma

但是我无法理解错过逗号的地方,并且忽略了这一规定。

1 个答案:

答案 0 :(得分:1)

您没有正确引用OLD列:

create or replace trigger HAPUS_PENDUDUK 
after delete on system.PENDUDUK
for each row
BEGIN
  insert into penduduk_backup values (
     old_nip , old_nama, nama_user, tanggal_perubahan || :OLD.nip, OLD.nama,
     current_user, sysdate()
  );
END;