Testing Null values inside trigger
920164Mar 22 2012 — edited Mar 22 2012Hi all;
I am writing a trigger on a table where i declared a var that takes its value from an oracle context i created, the var is set at the application level, my problem is that i don't want a certain action in the trigger to be taken if the var value is null, hence i used the IS NULL to test the var, but it dose not work, the action always gets executed regardless to the value of the var, do u have any idea?
CREATE OR REPLACE TRIGGER PSS.TEST
AFTER INSERT OR UPDATE OR DELETE ON PSS.MYTEST
FOR EACH ROW
DECLARE
l_screenId VARCHAR2(20);
BEGIN
SELECT SYS_CONTEXT('AUDIT_LOG_CTX', 'SCREEN_ID') INTO l_screenId from dual;
IF l_screenId IS NOT NULL then
dosomthing; // this always gets excuted
END IF;
END;
GO