Subject Doing something wrong with this trigger
Author diegodelafuente
Hi.

I'm trying to create a trigger to track changes in a table, after an update.
When I tried to compare the old and new field it works if a have data in both fields. If one of them has no value (null) it continues the trigger like if no changes are present in that field.
It seems that I can not compare "null" to a string value.
How can I know if a have differences changing from a null value to any value (not null)

example:
old.idnomencladoraux = null
new.idnomencladoraux = '420101'

or
old.idnomencladoraux = '420101'
new.idnomencladoraux = null

works fine
old.idnomencladoraux = '420101'
new.idnomencladoraux = '420102'



***********************************************
code
****************************************


AS
declare variable Cadena varchar(500);
begin
if (old.idnomencladoraux <> new.idnomencladoraux) then
if (:cadena is null) then
cadena = 'NomAux: ' || old.idnomencladoraux || ', por: ' || new.idnomencladoraux;
else
cadena = :cadena || 'NomAux: ' || old.idnomencladoraux || ', por: ' || new.idnomencladoraux;

if (old.descripcionaux <> new.descripcionaux) then
if (:cadena is null) then
cadena = 'DescAux: ' || old.descripcionaux || ', por: ' || new.descripcionaux;
else
cadena = :cadena || 'DescAux: ' || old.descripcionaux || ', por: ' || new.descripcionaux;


if (:cadena is null) then cadena = 'Sin Cambios';
insert into contratoshist (cadena) Values (:cadena);
/* Trigger text */
end