Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> sys_context('USERENV','SESSIONID') always Zero
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',
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);