If i insert record in table A and these record should update in table B by using Trigger.How to achieve this.
Answer Posted / abhishek jaiswal
Table 1(U_register)
Name Null? Type
----------------------------------------- -------- ----------------------------
FIRST_NAME PK VARCHAR2(15)
LAST_NAME NOT NULL VARCHAR2(15)
DOB NOT NULL DATE
USER_NAME NOT NULL VARCHAR2(15)
NEW_PASSWORD NOT NULL VARCHAR2(15)
CONFIRM_PASSWORD NOT NULL VARCHAR2(15)
U_ID NOT NULL NUMBER
Table 2(Login_detail)
Name Null? Type
-------------------------FK---------------- -------- ----------------------------
ID NOT NULL NUMBER
USER_NAME VARCHAR2(15)
NEW_PASSWORD VARCHAR2(15)
Now,We have to write trigger to insert of column 'user_name' and 'new_password' in login_detail table.
To do this we will use After insert trigger.
create or replace
trigger tgr_login
after insert on u_register
for each row
begin
insert into login_detail
values (:new.u_id,:new.user_name,:new.new_password);
end tgr_login;
---and It will work .
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
define join and explain different type of joins? : Sql dba
What is database white box testing and black box testing?
What is error ora-01000: maximum open cursors exceeded
Mention what does plv msg allows you to do?
How much does sql certification cost?
What does a pl/sql package consist of?
what are numeric data types? : Sql dba
How does a trigger work?
What is the location of pre_defined_functions.
how do you know if your mysql server is alive? : Sql dba
how can we find the number of rows in a table using mysql? : Sql dba
How to handle bulk data?
How to rename a table?
what is timestamp in mysql? : Sql dba
What is dba in sql? : SQL DBA