Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Testing Null values inside trigger

920164Mar 22 2012 — edited Mar 22 2012
Hi 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 19 2012
Added on Mar 22 2012
3 comments
4,214 views