By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,062 Members | 1,374 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,062 IT Pros & Developers. It's quick & easy.

one trigger for two different tables

100+
P: 138
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,
Jun 23 '08 #1
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 700
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
Jun 26 '08 #2

100+
P: 138
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,
Jun 27 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.