Yesterday, the head was assigned a task, mainly to write a trigger, used in one of the tables in a field update, the same table will also modify another field.
I yesterday that tangled ah!! For a long time, the main is not played before the trigger, after looking for some information, you can probably read the information on the Internet. However, I really think that there is too much information is in there nonsense, are CTRL + C and CTRL + +, interesting?!
Needless to say, first of all, I want to implement the operation of the same table, of course, when a field changes need to change the other field of the operation must be completed before the update, if completed after update, there will be deadlock phenomenon.
The specific trigger creation code is as follows:
Create or Replace Trigger Rudi_trigger
Before update of Inde_value on Rundata_up_daily_inde
For each row
Declare
--Local variables
Begin
If
: Old.id =:new.id
Then
: New.is_update:=1;
End If;
End Rudi_trigger;