Subject Re: [ib-support] OLD context variable behaviour on triggers
Author Martijn Tonies
Hi Hugo,

Yes, this is normal.

To check for NULL use:

IF (OLD.column IS NULL)


With regards,

Martijn Tonies

Firebird Workbench - the developer tool for Firebird
Upscene Productions
http://www.upscene.com

"This is an object-oriented system.
If we change anything, the users object."

> Firebird 1.0 Win32
> Let's suppose this table:
>
> CREATE TABLE PROVA(
> ID INTEGER NOT NULL PRIMARY KEY,
> ELMEUCAMP VARCHAR(8),
> HASCHANGED CHAR(1)
> );
>
> and this trigger:
>
> CREATE TRIGGER MyTriggerBU FOR PROVA
> BEFORE UPDATE AS
> BEGIN
>
> IF(OLD.ELMEUCAMP!=NEW.ELMEUCAMP) THEN
> NEW.HASCHANGED='X';
>
> END
>
> I'm find that, when I change ELMEUCAMP field value from NULL to something
not null, the trigger doesn't perform the THEN statement !!
> It's to say, if OLD.FIELD=null and NEW.FIELD='ABCD', they are equals for
the trigger.
>
> Is this normal? Maybe the problem is the VARCHAR type?
>
> Thanks in advance,
> Hugo.
>
>
> [Non-text portions of this message have been removed]
>
>
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>