Create or replace trigger usertotemp after insert or update or delete
On user_info for each row // triggers the following events when operating on the table user_info
Declare // declare a variable
Integrity_error exception;
Errno integer;
Errmsg char (200 );
Dummy integer;
Found Boolean;
Sexy varchar2 (20 );
Begin
If inserting then
Select sex into sexy from user_info_test; // obtain the value of the sex field in the user_info_test table and assign it to the variable sexy.
Insert into user_info_temp (ID, username, password, createdate, status) values (: New. ID,: New. username, sexy,: New. createdate,: New. status); //: New. the username value is the newly added data in table user_info.
Elsif updating then
Update user_info_temp Set ID =: New. ID, username =: New. username, password =: New. Password, status =: New. status where id =: Old. ID;
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service