Write to the alert log from PL/SQL code

The following undocumented function could be used to write to the alert log:


execute sys.dbms_system.ksdwrt(code, message);

Parameters:

1 – Write to trace file.
2 – Write to alertlog.
3 – Write to both.

Example:

execute sys.dbms_system.ksdwrt(2,to_char(sysdate, 'Dy Mon DD HH24:MI:SS YYYY')||'Hello!' );


create or replace trigger trg_delme
BEFORE UPDATE on frodo.delme
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
begin
sys.dbms_system.ksdwrt(2,to_char(sysdate, 'Dy Mon DD HH24:MI:SS YYYY') );
end;

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.