Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Help: Is there any way I can catch the sql that calls the function from inside the function?
Tracing is not acceptable. It is application we are talking about.
Fine_Grained Access Auditing works great in this case.
You add a policy to the table, when anybody select the table, Oracle will
insert a row with sql in sys.dba_fga_audit_trail. All I need to do is in my
function, I just add
.....
l_sql_text varchar2(2000);
Begin
select sql_text into l_sql_text from (select sql_text from
sys.dba_fga_audit_trail
where session_id=sys_context('USERENV','SESSIONID')
order by timestamp desc) where rownum < 1;
......
end;
> I don't see how fined grained auditing or autonomous transaction is
> relevant to your request. Your calling SQL and the SQL inside the
> function are both in library cache (v$sql e.g.). But the difficulty is
> how to associate them. If you find a good answer, please post back.
>
Received on Mon Nov 14 2005 - 18:50:25 CST