Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / January 2005

Tip: Looking for answers? Try searching our database.

Before delete triggers

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
uninfmx@yahoo.com - 20 Jan 2005 15:05 GMT
Hi

If one or mode records get deleted from t1 (see below), I'd like
delete all the corresponding records from t2. There is no foreign key
relationship between t2 and t1, so cascading delete is not an option.
V8.2 AIX

create table t1
(
x int
);
create table t2
(
y int
);

insert into t1 values (2);
insert into t2 values (2);
Can this be accomplished using before delete trigger:

create trigger some_del
no cascade before delete on t1
referencing old as old_t for each row
delete from t2 where y= old_t.x

DB21034E  The command was processed as an SQL statement because it was
not a
valid Command Line Processor command.  During SQL processing it
returned:
SQL0696N  The definition of trigger "AAA.some_del " includes an invalid
use
of correlation name or transition table name "old".  Reason code="1".
LINE
NUMBER=3.  SQLSTATE=42898

Thanks
Serge Rielau - 21 Jan 2005 03:30 GMT
> Hi
>
[quoted text clipped - 32 lines]
>
> Thanks

Use an AFTER DELETE trigger.

Signature

Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab

uninfmx@yahoo.com - 21 Jan 2005 14:58 GMT
Thanks. The 3rd party software requires that this be a before delete
trigger - don't know why. I did mention after delete trigger to them.

> > Hi
> >
[quoted text clipped - 34 lines]
> >
> Use an AFTER DELETE trigger.
Serge Rielau - 21 Jan 2005 16:33 GMT
> Thanks. The 3rd party software requires that this be a before delete
> trigger - don't know why. I did mention after delete trigger to them.
[quoted text clipped - 52 lines]
>>
>>Use an AFTER DELETE trigger.

*sigh*There are good semantic reasons why the SQL Standard prohibits
updates in before triggers....
Anyway. Ask the vendor whether they are aware of the "ISV enablement
team" of IBM. Porting help can be arranged.

Cheers
Serge

Signature

Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.