Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is the difference between delete and truncate commands?

975


Write a sql query to get the third highest salary of an employee from employee_table?

1026


what is bcp? When is it used?

1046


What is cursor explain with example?

921


What is over () in sql?

892


What do you understand by case manipulation functions?

952


when MSQL8.0 is in market

2014


How do I start sql from command line?

961


What is natural join in sql?

916


how to escape special characters in sql statements? : Sql dba

967


How do I tune a sql query?

933


What is online transaction processing (oltp)?

961


How global cursor can be declare with dynamic trigger ?

2146


what is the difference between join and union? : Sql dba

1027


What is assignment operator in pl sql?

968