Subject RE: [firebird-support] Before Delete trigger
Author Goutam Paruchuri
Do you want to do it on the database side. You can do a join (inner) and
get all records where markid does exist.
Use a where clause. E.g delete from table where markid in (1,2)..

Maybe you can write a sql procedure to loop thru records and delete ones
which don't exist (on database side).

- Goutam


> -----Original Message-----
> From: yaedos2000 [mailto:yaedos2000@...]
> Sent: Monday, December 20, 2004 6:21 AM
> To: firebird-support@yahoogroups.com
> Subject: [firebird-support] Before Delete trigger
>
>
>
>
> Hi,
>
> I've got two tables, TBL_MARKER and TBL_MTRNS, both of which
> contain a field MARKID.
>
> I have a procedure which deletes a row from TBL_MARKER
> (DELETE FROM TBL_MARKER WHERE MARKID = SOME_VALUE). But this
> row can only be deleted if MARKID from TBL_MARKER doesn't
> exist in TBL_MTRNS. If it does then the delete cannot take place.
>
> I'm developing a Before Delete trigger to test for this and
> to stop the delete occuring if MARKID exists in the other table.
>
> How would I check each row of TBL_MTRNS for a match? Could it
> be done using a SELECT statement, ie. SELECT MARKID FROM
> TBL_MTRNS? And how would I stop the delete from occur if
> there is a match?
>
> CREATE TRIGGER BD_MARKER FOR TBL_MARKER
> ACTIVE BEFORE DELETE POSITION 0
> AS
> BEGIN
> END ^
>
> Thanks
>
>
>
>
>
> ------------------------ Yahoo! Groups Sponsor
> --------------------~--> Make a clean sweep of pop-up ads.
> Yahoo! Companion Toolbar.
> Now with Pop-Up Blocker. Get it for free!
> http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/67folB/TM
> --------------------------------------------------------------
> ------~->
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>


Confidentiality Notice
The information contained in this e-mail is confidential and intended for use only by the person(s) or organization listed in the address. If you have received this communication in error, please contact the sender at O'Neil & Associates, Inc., immediately. Any copying, dissemination, or distribution of this communication, other than by the intended recipient, is strictly prohibited.