Subject Re: acces on old field value on after delete
Author james_027
> old.* values are available in Update and Delete triggers.
> 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?

begin
/* 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?

regards,
james