atilho @INSERT para inserir registro na mesma tabela
Eu tenho um gatilho que é acionado ao inserir um novo registro na tabela em que desejo inserir um novo registro na mesma tabel
Meu gatilho é:
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;
dá um erro como
ORA-04091: table TEST_TABLE is mutating, trigger/function may not see it
acho que está me impedindo de inserir na mesma tabel
omo posso inserir esse novo registro na mesma tabel
Nota: - Estou usandoOracle como banco de dados