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','CURRENT_SQL') Returns NULL

660227Dec 9 2008 — edited Mar 9 2009
Hi all

I created a trigger on a table to audit any data changes. in the trigger i have the following:

after insert or update or delete
on some_data_table
referencing new as new old as old
for each row
declare
sqltext VARCHAR2(2000) := sys_context('USERENV','CURRENT_SQL');
begin

insert into some_table (sql_text) values (sqltext);
end;
/


The problem is sqltext is always null ?? can anyone say why ? ideally I need the trigger to capture the SQL and insert in the log table for auditing reasons
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 6 2009
Added on Dec 9 2008
9 comments
1,042 views