Subject | OLD context variable behaviour on triggers |
---|---|
Author | Hugo |
Post date | 2002-12-05T11:59:46Z |
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]
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]