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!

sys_context( 'USERENV', 'CLIENT_INFO' ) returning null

2886234Feb 17 2015 — edited Feb 17 2015

Hi,

I am new to oracle and here in my application I have set dbms_application_info.set_client_info( 'TEST' ); in the beginning of my procedure.

Now I have created a trigger before update in which I am checking if sys_context( 'USERENV', 'CLIENT_INFO' ) = 'TEST', but I am getting null value for this. Does sys_context have any scope under which we can set and retrieve its value ?

Here is my trigger script :

CREATE OR REPLACE TRIGGER SCHEMA.TRIG_A_UPDATE

BEFORE UPDATE

ON QC_SCHEMA.A_FUNDING

REFERENCING NEW AS NEW OLD AS OLD

FOR EACH ROW

DECLARE

pragma autonomous_transaction;

userenv_value varchar2(200);

BEGIN

    select sys_context( 'USERENV', 'CLIENT_INFO' ) into userenv_value from dual;

             if :NEW.FUND <> :OLD.FUND then

                   if userenv_value = 'TEST' then    // this line is not working
                        :NEW.UPDT_DT := :OLD.UPDT_DT;

                    end if;

          else

             :NEW.UPDT_DT := sysdate;

   end if;

             

END A_FUNDING_UPDATE;

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 17 2015
Added on Feb 17 2015
21 comments
1,402 views