关于oracle:如何在Trigger内调用无参数存储过程

How to call no argument stored procedure inside Trigger

我正在尝试从触发器

调用存储过程

1
2
3
4
5
6
create or replace trigger trg_insert
after insert on dbuser_m1
for each row
begin
InsertData;
end;

但低于错误

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.

有人可以帮我吗?谢谢,


除了@KaushikNayak所说的以外,似乎您在表dbuser_m1中有一个select,而它正在由DML(在这种情况下为insert)处理。

我们不知道您在InsertData

中的代码

但是我想,

而不是使用这样的语句select col1, col2 into v_col1, v_col2 from dbuser_m1;
您可以在调用过程中将某些值带有dbuser_m1列值的参数应用于您的过程,例如InsertData(:old.col1,:old.col2),在被调用过程中可能会有赋值:

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

其中v_col1dbuser_m1.col1%type类型,v_col2dbuser_m1.col2%type类型。