Oracle trigger
-- Create table a trigger
Create table T_AC_TEST
(
ID VARCHAR2 (32) not null primary key
AT_SWITCH CHAR (1)
AT_UPDATE_TIME DATE
AT_UPDATE_MAN VARCHAR2 (50)
)
-- add several pieces of data
Select * from t_ac_test for update
-- verify the trigger to create a new b table
Create table T_AC_TEST1
(
ID VARCHAR2 (32) not null primary key
AT_SWITCH CHAR (1)
AT_UPDATE_MAN VARCHAR2 (50)
)
-- add several pieces of data
Select * from T_AC_TEST1 for update
-- create a trigger. The corresponding function is that when the content of table an is modified, table b saves the modified contents of table a.
Create or replace trigger tri_ins_EST_MOTHERFUCKER-create trigger
After update-modified operation
On ACT.t_Ac_Test-the table after on is the table to be modified act is the table to be modified by the owner of the table t _ ac_test
For each row-indicates that the row-level trigger is created
Begin
Insert into ACT.t_Ac_Test1 (ID,AT_SWITCH,AT_UPDATE_MAN)
Values
(: NEW. ID
: NEW.AT_SWITCH
: NEW.AT_UPDATE_MAN)
End
-- create a trigger
Create or replace trigger tri_test--
Before delete--
On ACT.t_Ac_Test-- on act t _ ac_test
For each row
Begin
Insert into ACT.t_Ac_Test1 (ID,AT_SWITCH,AT_UPDATE_MAN)
Values
(: NEW. ID
: NEW.AT_SWITCH
: NEW.AT_UPDATE_MAN)
End
-- query statements for 2 tables
Select * from t_ac_test1
Select * from t_ac_test
Modify table a trigger stone execution and check whether the contents of table b have fields modified by table a
Update T_AC_TEST t set t.at_update_man =''where t. Id =' 4028810f3bb26aa2013bb2babe450099'
Delete from t_ac_test where id = '4028810f3bb26aa2013bb2babe450088'