Subject | Re: [firebird-support] Re: acces on old field value on after delete |
---|---|
Author | Helen Borrie |
Post date | 2004-08-28T06:50:23Z |
At 05:22 AM 28/08/2004 +0000, you wrote:
e.g.
if (not deleting) then ...
version, you will get an exception if your delete trigger code refers to
the NEW variables or your insert code refers to the OLD.
> > old.* values are available in Update and Delete triggers.Yes!! read the release notes and note my comment above.
> > new.* values are available in Insert and Update triggers.
> >
> >
> > >My reason I want to use the after delete is because I just want to
> > >write a single trigger for after insert, after update and after delete
> > >event.
> >
> > Sure, but it will have to include conditional blocks according to the
> > states of the Updating, Inserting and Deleting context variables.
> >
>
>Hi Helen
>
>I have this trigger for insert, update, delete. So far in my testing
>everything work fine. In our statement above, do we a special variable
>to know if the state is updating, inserting or deleting?
e.g.
if (not deleting) then ...
>beginCurrently, yes. But the behaviour is changed in HEAD so, in the next
> /* update po details serve qty */
> update "podetails"
> set "Serve" = "Serve" - old."Qty"
> where "Key" = old."PoID";
>
> update "podetails"
> set "Serve" = "Serve" + new."Qty"
> where "Key" = new."PoID";
>
>
>
> /* udpate the inventory in the items */
> update "items"
> set "Left" = "Left" - (old."Qty" * Old."Conversion")
> where "ID" = old."ItemID";
>
> update "items"
> set "Left" = "Left" + (new."Qty" * new."Conversion")
> where "ID" = new."ItemID";
>end
>
>Iam wondering that are the values of old.field values in the insert
>event and the values of the new.field values in the delete event. Is
>it null? If null then the result of the update statement will null right?
version, you will get an exception if your delete trigger code refers to
the NEW variables or your insert code refers to the OLD.
>regards,
>james
>
>
>
>
>
>Yahoo! Groups Links
>
>
>
>