我正在尝试在我的DML中使用LOG ERRORS INTO来删除对象。
create table av_parent( id number primary key, name varchar2(20));
create table av_child (id number primary key, p_id number, foreign key(p_id) references av_parent(id) );
insert into av_parent values (1,'a');
insert into av_parent values (2,'sa');
insert into av_parent values (3,'af');
insert into av_parent values (4,'ah');
insert into av_child values (11,1);
insert into av_child values (12,2);
BEGIN
DBMS_ERRLOG.create_error_log (dml_table_name => 'av_parent');
end;
/
select * from err$_av_parent;
delete from av_parent where id=1 LOG ERRORS INTO err$_av_parent ('DELETE') REJECT LIMIT UNLIMITED;
这里,当我删除时,错误消息" ORA-02292:违反完整性约束(XYZ.SYS_C00848165) - 找到子记录 "被插入到日志表中。
我现在在删除时添加一个触发器,但什么都不做
create or replace trigger t_av_parent
before delete
on av_parent
REFERENCING NEW AS NEW OLD AS OLD
for each row
begin
null;
end;
当我使用相同的命令删除时,错误会弹出并且不会插入日志表中。
delete from av_parent where id=1 LOG ERRORS INTO err$_av_parent ('DELETE') REJECT LIMIT UNLIMITED;
感谢任何帮助。 感谢