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 -> Re: Why my sys_context('USERENV','CURRENT_SQL') is null?

Re: Why my sys_context('USERENV','CURRENT_SQL') is null?

From: DA Morgan <damorgan_at_psoug.org>
Date: Wed, 09 Nov 2005 20:43:49 -0800
Message-ID: <1131597900.334634@yasure>


NewRacGuy wrote:
> I am studying the use of sys_context.(Oracle 9206)
> I created a function
> -----------------------
> create or replace function test_function
> (l_data_input in varchar2)
> return varchar2 as
> result varchar2(2000);
> begin
> result :=sys_context('USERENV','CURRENT_SQL');
> return result;
> -------------------------
> Then I do
> select test_function(ssn) from test;
> I have already enabled FGA on ssn column on table test, and I have verified
> that the select statement has put an entry in DBA_FGA_AUDIT_TRAIL.
>
> According to the ducument, sys_context('USERENV','CURRENT_SQL') "Returns the
> first 4K bytes of the current SQL that triggered the fine-grained auditing
> event.", but in my case, sys_context('USERENV','CURRENT_SQL') always
> returns null. I am expecting it returns "select test_function(ssn) from
> test".
>
> Why is that? Can somebody help?
>
> Thanks very much for your help.

I believe it needs to be in a trigger.

-- 
Daniel A. Morgan
http://www.psoug.org
damorgan_at_x.washington.edu
(replace x with u to respond)
Received on Wed Nov 09 2005 - 22:43:49 CST

Original text of this message

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