sys_context('USERENV','CURRENT_SQL') Returns NULL
660227Dec 9 2008 — edited Mar 9 2009Hi 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