Hi,
DB2 LUW 8.2
We would like to implement a trigger to stop an insert or "empty
row" (under certain conditions), but not to throw an exception back to
calling application i.e the calling application would be unaware that
the insert had been stopped.
Sounds a bit crazy perhaps, but is it possible?
Thanks.
Serge Rielau - 25 Apr 2007 18:16 GMT
> Hi,
>
[quoted text clipped - 6 lines]
>
> Sounds a bit crazy perhaps, but is it possible?
If you can route the app through a view you can use an INSTEAD OF TRIGGER
to selectively ditch rows...
Cheers
Serge

Signature
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Tonkuma - 26 Apr 2007 09:12 GMT
If exceptional rows are not so many,
how about DELETE unneccesary row?
CREATE TRIGGER Delete_Blank_ISRT
AFTER INSERT ON Inhibit_Blank_ISRT
REFERENCING NEW AS N
FOR EACH ROW
WHEN ( N.col1 = '' AND N.col2 = '' )
DELETE FROM Inhibit_Blank_ISRT
WHERE col1 = '' AND col2 = '';
It will be better to CREATE INDEX for performance.
PaulReddin - 27 Apr 2007 12:27 GMT
Thanks for the ideas.
We'll give them a go!