Connecting Tech Pros Worldwide Help | Site Map

one trigger for two different tables

Member
 
Join Date: Mar 2007
Posts: 117
#1: Jun 23 '08
hi all,
can we write a trigger in such a way that same trigger is fired when any query executes for two different tables.
i mean to say,
i have two tables tbla, tblb. right now i have written one trigger which inserts in tblc whenever there is any insertion, deletion or updation in tbla. now what i want is can i insert in tlbc itself when i have insertion, or deletion or updation in tblb also at the same time. some field of tbla and some field of tblb.

ie
tbla contains name, address
tblb contains tel,mailing_add.
now when a trigger is fired, then tlbc should contain tbla.name, tblb.mailng_add.
can it be done?

with regards,
Moderator
 
Join Date: Dec 2006
Location: Europe
Posts: 292
#2: Jun 26 '08

re: one trigger for two different tables


i'm afraid my english s not good enough to understand what you need.
You want a trigger which is fired when you for example delete from both tables simultaneously?
or you want a trigger witch is fired when you for example delete from tab_a or tab_b and which is inserting data from both tables into tab_c?

sorry for my poor english
Member
 
Join Date: Mar 2007
Posts: 117
#3: Jun 27 '08

re: one trigger for two different tables


thanx rski,
let me clear my problem. i 'm using vb6 and postgres. my one form inserts data in both tbl_a and tbl_b simultaneously. whenever i have to update or insert or delete in that form, both the tables tbl_a and tbl_b get effected.

so whenever i delete or update or insert in that form i want a trigger to be fired so that i can insert the old data of both tables in the new table tbl_c.

now i think you are clear.

is it possible to do so?
with regards,
Reply