1CREATE [OR REPLACE ] TRIGGER trigger_name
2{BEFORE | AFTER | INSTEAD OF }
3{INSERT [OR] | UPDATE [OR] | DELETE}
4[OF col_name]
5ON table_name
6[REFERENCING OLD AS o NEW AS n]
7[FOR EACH ROW]
8WHEN (condition)
9DECLARE
10 Declaration-statements
11BEGIN
12 Executable-statements
13EXCEPTION
14 Exception-handling-statements
15END;
1CREATE OR REPLACE TRIGGER my_schema.trigger_name AFTER LOGON ON DATABASE
2BEGIN
3 INSERT INTO my_log_table
4 VALUES (USER AS CONNECTED_USER,
5 sys_context('USERENV', 'SESSIONID') AS SESSION_ID,
6 substr(sys_context('USERENV', 'OS_USER'), 1, 50) AS OS_USER,
7 substr(sys_context('USERENV', 'HOST'), 1, 30) AS HOST,
8 SYSDATE AS LOGON_DATE);
9END;
10ALTER TRIGGER my_schema.trigger_name ENABLE;