如何在触发器中调用无参数存储过程
How to call no argument stored procedure inside Trigger
我正在尝试从触发器调用存储过程
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 所说的,似乎你有一个来自 table 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_col1
是 dbuser_m1.col1%type
类型,v_col2
是 dbuser_m1.col2%type
.
类型
我正在尝试从触发器调用存储过程
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 所说的,似乎你有一个来自 table 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_col1
是 dbuser_m1.col1%type
类型,v_col2
是 dbuser_m1.col2%type
.