The business description is as follows:
When inserting a table, you need to update the value of another field based on the value of one field. Of course, it can also be implemented through a program, but this field is only used for data exchange. It has nothing to do with the main business of the system and does not want to modify the program. Therefore, it can be implemented using a trigger.
Table Structure Definition and trigger definition are as follows:
create table debug_demo1(id varchar(32),name varchar(100),note varchar(200),primary key(id));create or replace trigger tri_debug_demo1before insert on debug_demo1for each rowbeginupdate debug_demo1 set note = 'test' where id = :new.id;end tri_debug_demo1;
As a result, an oracle ORA-04091 exception occurred while performing the insert operation.
ORA-04091: The table debug_demo1 has changed trigger/function cannot read it
ORA-06512: In tri_debug_demo1 line...
ORA-04088: tri_debug_demo1 error during execution
For this exception, this post is described in detail at http://www.iteye.com/topic/1124681.
After reading this post at http://www.itpub.net/thread-1615812-1-1.html, I found a new website, which directly assigned values to the field.
The modified trigger is as follows:
create or replace trigger tri_debug_demo1before insert on debug_demo1for each rowbegin:new.note := 'test';end tri_debug_demo1;
After testing, the insert operation can be performed normally and the expected results can also be met.