Can you please tell me if I am using decode correctly in this update statement? I am trying to compare a new and an old value in a trigger code and if the old value is not null and the new value is null, I would like for the value inserted into the table to be blank and not the value 'NULL'. If the new student_id is not null, then to just insert the real value.
ELSE
IF old.student_flag = 'ACTIVE') AND new.student_flag = 'ACTIVE') THEN
IF NVLold.student_id, 'NULL') <> NVLnew.student_id, 'NULL') THEN
UPDATE test.test_student
SET student_id = DECODEnew.student_id, 'NULL', '', :new.student_id)
WHERE student_num = ld.student_num;
Thanks for your help in advance!
ELSE
IF old.student_flag = 'ACTIVE') AND new.student_flag = 'ACTIVE') THEN
IF NVLold.student_id, 'NULL') <> NVLnew.student_id, 'NULL') THEN
UPDATE test.test_student
SET student_id = DECODEnew.student_id, 'NULL', '', :new.student_id)
WHERE student_num = ld.student_num;
Thanks for your help in advance!