oracle - Before update trigger is not creating history for null values -
my before update trigger not creating history changing null value other value. creating history changing other values. main logic this:
if nvl(:old.place,null) <> nvl(:new.place,null) insert table (place) values(:old.place) end if;
the nvl()
function used substitute value in place of null. you're replacing null with... null, pointless. you're trying compare 2 null values (in)equality operator, , null neither equal or not equal including itself, result unknown, , condition false if either old or new value null.
you use fixed dummy value know never exit:
if nvl(:old.place,'**fake**') <> nvl(:new.place,'**fake**')
but clarity i'd prefer explicitly test nulls:
if (:old.place null , :new.place not null) or (:old.place not null , :new.place null) or (:old.place != :new.place)
Comments
Post a Comment