简体   繁体   中英

How to call no argument stored procedure inside Trigger

I am trying to call stored procedure from trigger

create or replace trigger trg_insert
after insert on dbuser_m1 
for each row 
begin
InsertData;
end;

but getting below erro

ORA-04088: error during execution of trigger 'OWS_GO_UAT_02.TRG_INSERT' 04091. 00000 - "table %s.%s is mutating, trigger/function may not see it" *Cause: A trigger (or a user defined plsql function that is referenced in this statement) attempted to look at (or modify) a table that was in the middle of being modified by the statement which fired it. *Action: Rewrite the trigger (or function) so it does not read that table.

Anyone can help me on this please?Thanks,

Besides what @KaushikNayak told, it seems you have a select from table dbuser_m1 while it's being processed by a DML( insert in this case).

We don't know your code inside InsertData ,

but i guess ,

instead of using such a statement select col1, col2 into v_col1, v_col2 from dbuser_m1; ,
you can apply some assignments with some arguments with column values of dbuser_m1 to your procedure like InsertData(:old.col1,:old.col2) while calling, and inside called procedure there maybe assignments :

v_col1 := :old.col1; v_col2 := :old.col2;

where v_col1 is of type dbuser_m1.col1%type and v_col2 is of type dbuser_m1.col2%type .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM