Subject Re: [firebird-support] Re: acces on old field value on after delete
Author Ivan Prenosil
> If yes then why is it that the update result is not null? for example
> if i have this ...
>
> update table
> set qty = qty -old.qty + new.qty
>
> in after insert event wherein the old.qty is null.

Is it your complete command, or is there also WHERE clause, like

update table
set qty = qty -old.qty + new.qty
where id = old.id;
?

Ivan


----- Original Message -----
From: "james_027" <james_027@...>
To: <firebird-support@yahoogroups.com>
Sent: Saturday, August 28, 2004 9:05 AM
Subject: [firebird-support] Re: acces on old field value on after delete


> > >
> > >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?
> >
> > Currently, yes. But the behaviour is changed in HEAD so, in the next
> > version, you will get an exception if your delete trigger code
> refers to
> > the NEW variables or your insert code refers to the OLD.
> >
> If yes then why is it that the update result is not null? for example
> if i have this ...
>
> update table
> set qty = qty -old.qty + new.qty
>
> in after insert event wherein the old.qty is null.
>
> regards,
> james