Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to automatic update a table using a trigger?

Status
Not open for further replies.

hedub

Technical User
Mar 5, 2003
27
NO
Hi, i am a newbie when it comes to pl/sql and programming triggers and procedures etc.

I have to tables, lets call them Tab1 and Tab2. I wish that the trigger will execute and update Tab2 after insert on Tab1. Most of the attributes are the same in Tab1 as in Tab2. Tab2 is for statistics. How do I do this? I know how to trigger a table when it comes to the same table, but not from one table to another. Can anyone help me? pls tell me if you want more info. Thanks.
 
Just add an appropriate insert and/or update statements using :new or :eek:ld modifiers. Suppose you have tables:

A(a varchar2(10))
A_JN(a_old varchar2(10),a_new varchar2(10), change_date date)

You may place the following code into row-level trigger on A:

insert into A_JN values:)old.a, :new.a, sysdate);
Regards, Dima
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top