同じテーブルに新しいレコードを挿入したいという点で、テーブルに新しいレコードを挿入するときに発生するトリガーがあります。
私のトリガーは:
create or replace trigger inst_table
after insert on test_table referencing new as new old as old
for each row
declare
df_name varchar2(500);
df_desc varchar2(2000);
begin
df_name := :new.name;
df_desc := :new.description;
if inserting then
FOR item IN (SELECT pid FROM tbl2 where pid not in(1))
LOOP
insert into test_table (name,description,pid) values(df_name,df_desc,item.pid);
END LOOP;
end if;
end;
そのようなエラーが発生します
ORA-04091: table TEST_TABLE is mutating, trigger/function may not see it
同じテーブルに挿入するのを妨げていると思います。
この新しいレコードを同じテーブルに挿入するにはどうすればよいですか。
注:-データベースとしてOracle を使用しています