CodePudding user response:
The main trigger is how to writeCodePudding user response:
Write you a example
-
SQL>
SQL> Create table ta (int id, name varchar (10), the age int);
The Table created
SQL> The create table TB (id int, old_name varchar (10), new_name varchar (10));
The Table created
SQL> Create the trigger tri_ta_update
2 before the update on ta
3 for each row
4 the begin
Insert into 5 TB (id, old_name, new_name)
6 values (: new id, : old. Name, : new, name);
7 the end;
8/
The Trigger created
SQL> The begin
2 insert into ta values (100, 'zs, 100);
3 the update ta set name='ABC';
4 the update ta set name='zxy';
5 the end;
6/
PL/SQL procedure successfully completed
SQL> Col id format a5;
SQL> Select * from ta;
ID NAME AGE
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
100 zxy 100
SQL> Select * from TB;
ID OLD_NAME NEW_NAME
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
100 zs ABC
100 ABC zxy
SQL> Drop table ta purge;
Table dropped
SQL> Drop table TB purge;
Table dropped
SQL>
CodePudding user response:
If I want to update the content of time and which update operations (update the insert delect), are written in the B on the table, can realize aCodePudding user response:
Please, for example, had better use excel to draw once, what do you want to achieve,CodePudding user response:
CodePudding user response:
CodePudding user response:
I drew this picture, can achieve it