If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > How to delete a row froma table using trigger federated db

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-20-04, 07:30
bsaganand bsaganand is offline
Registered User
 
Join Date: Jan 2004
Location: Mumbai, India
Posts: 16
How to delete a row froma table using trigger federated db

Hi
I have created the federated db and wrote trigger to enforce referential integrity thru trigger for updation and insertion. Now my need is if i delete the row in one table whixh is in databaseA, it should delete the child rows in yable resides in databaseB.
Pls help me in this issue. I will give the trigger which is worked for insertion here,
CREATE TRIGGER Test1
no cascade before insert ON S_Company
REFERENCING NEW AS N FOR EACH ROW MODE DB2SQL
WHEN (clientid NOT IN (SELECT clientid FROM s_client))
SIGNAL SQLSTATE '75000' ('Referencial integrity Error before insert')

My table structure is

Database A, Table S_Client
clientid integer not null,
Description Varchar(30),
Location Varchar(30),
companyid integer not null,
dbname varchar(20)

Database B table S_Company

companyid integer not null,
Description Varchar(30),
Location Varchar(30),
clientid integer not null,
if i delete the Client in db A, it should delete the companies having clientid same in DB B

Sakthi
__________________
G.Sakthi
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On