Home > database >  Create a trigger that each additional return card, just in the theme of the corresponding to the tot
Create a trigger that each additional return card, just in the theme of the corresponding to the tot

Time:09-29

5) to create a trigger, every increase a return card, makes in the theme of the corresponding to the total number of modified reply + 1
The set serveroutput on.
The create or replace the trigger addTopic_tri after insert on T_reply
For each row
Declare
V_tid number (10);
The begin
Select dar into v_tid from T_REPLY where tid=: new, dar.
The update T_Topic
Set Treply=Treply + 1 where T_Topic. Tid=: new, dar.
end;
Insert into T_reply (rids, dar, Rsubject, Rcontent, Ruser, Rdate) values (reply_seq nextval, 3, 'xiao Ming to get married? ', 'I' in the university entrance exam, 24, sysdate);



SQL error: ORA - 04091: table USER_ZHANGZHENYUN. T_REPLY changed, the trigger/function can't read it
ORA - 06512: the "USER_ZHANGZHENYUN ADDTOPIC_TRI", line 4
ORA - 04088: the trigger 'USER_ZHANGZHENYUN. ADDTOPIC_TRI' error during the execution of
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.
The TRIGGER ADDTOPIC_TRI compiled

CodePudding user response:

Table USER_ZHANGZHENYUN. T_REPLY changed, the trigger/function can't read it
ORA - 06512: the "USER_ZHANGZHENYUN ADDTOPIC_TRI", line 4
ORA - 04088: the trigger 'USER_ZHANGZHENYUN. ADDTOPIC_TRI' error during the execution of
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.



Great god solve???

CodePudding user response:

5) to create a trigger, every increase a return card, makes in the theme of the corresponding to the total number of modified reply + 1
The set serveroutput on.
The create or replace the trigger addTopic_tri after insert on T_reply
For each row
Declare
The begin
The update T_Topic
The set Treply=Treply + 1 where tid=: new. Dar;
end;

Show the error;

CodePudding user response:

The original poster 2 # statement, should have no problem; Direct reference: new col_name is ok,
  • Related