Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> sys_context('USERENV','SESSIONID') always Zero

sys_context('USERENV','SESSIONID') always Zero

From: IPower <power_ian_at_hotmail.com>
Date: 3 Sep 2004 09:52:44 -0700
Message-ID: <2a7205f3.0409030852.9e40b9d@posting.google.com>


I am an oracle newbie, I am looking for information on a current problem I am coming across. I am trying to implement fga using a procedure to populate a user-defined table to track audit information. In this procedure I am trying to use
sys_context('USERENV','SESSIONID'), to retrieve the current session id. When I view the data the audit session id is always zero. Why? I am using a 10g oracle database. Here is my code: begin
 dbms_fga.add_policy(

 object_schema=>'TEST', 
 object_name=>'DIARY', 
 policy_name=>'DIARY_ACCESS', 

 handler_schema => 'TEST',
 handler_module => 'LOGERROR',
 statement_types => 'SELECT, INSERT, DELETE, UPDATE',  enable => true
);
end;

CREATE OR REPLACE PROCEDURE LOGERROR(V_SCHEMA VARCHAR2, V_TABLE VARCHAR2,
V_POLICY VARCHAR2) AS BEGIN
--insert into test1 table
INSERT INTO test1
(

audit_session_id,
timestamp,
owner,
object_name,
policy_name
)
VALUES
(

sys_context('USERENV','SESSIONID'),
sysdate,

v_schema, 
v_table, 
v_policy); 

END; Went I select * from diary and check my table auditsessionId is returned as zero. However when I select
sys_context('USERENV','SESSIONID') from dual I receive the correct sessionId. If possible can someone explain why my audit_session_Id is always zero in the test1 table. Received on Fri Sep 03 2004 - 11:52:44 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US