Jean-Francois Leveque wrote:
>
> I want to check something before
> a delete is made.
>
> I made a before delete trigger that
> calls a procedure.
>
> The procedure raises an exception
> when I don't want the delete to be
> made (I could also have returned NULL,
> but wouldn't have get much information
> from it).
>
>
> The question is :
> What do I return when I want the delete to be made ?
>
> If I return OLD (known when deleting), maybe that
> cancels the delete too.
>
> I don't have NEW (known only on insert/update).
>
> I couldn't find the answer in the docs.

    Returning  OLD  from  a  BEFORE  ROW trigger let's the delete
    happen - no "maybe" here.  On AFTER ROW triggers  it  doesn't
    matter  what  you  return, the delete happened already (well,
    RAISE EXCEPTION will rollback of course).


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Tue, 3 Jul 2001 09:46:56 -0400 (EDT)
Jan Wieck <JanWieck@Yahoo.com>
Re: Trigger Procedures question

I want to check something before
a delete is made.

I made a before delete trigger that
calls a procedure.

The procedure raises an exception
when I don't want the delete to be
made (I could also have returned NULL,
but wouldn't have get much information
from it).


The question is :
What do I return when I want the delete to be made ?

If I return OLD (known when deleting), maybe that
cancels the delete too.

I don't have NEW (known only on insert/update).

I couldn't find the answer in the docs.


Best regards,

Jean-Francois Leveque


______________________________________________________________________
Sur WebMailS.com, mon adresse de courrier �lectronique gratuite.
Service multilingue, s�r, et permanent. http://www.webmails.com/

Tue, 3 Jul 2001 14:59:1 +0100
"Jean-Francois Leveque" <leveque@webmails.com>
Trigger Procedures question