Oracle Trigger Case Study
Trigger Case Study CREATE TABLE LOG_TRIG_TABLE (USER_ID VARCHAR2(8), LOG_DATE DATE, ACTION VARCHAR2(20)); CREATE TABLE LOG_TRIG_TABLE_ALL (USER_ID VARCHAR2(8), LOG_DATE DATE, ACTION VARCHAR2(20)); CREATE TABLE DML_LOG_TRIG_TABLE (USER_NAME VARCHAR2(8), DML_DATE DATE, DML_TYPE VARCHAR2(8)); ------------------- TRACK BEFORE LOGON CREATE OR REPLACE TRIGGER LOGON_TRIG AFTER LOGON ON SCHEMA BEGIN INSERT INTO LOG_TRIG_TABLE (USER_ID,LOG_DATE, ACTION) VALUES (USER,SYSDATE,'LOGGING ON '); END; / CREATE OR REPLACE TRIGGER LOGON_TRIG_ALL AFTER LOGON ON DATABASE BEGIN INSERT INTO LOG_TRIG_TABLE_ALL (USER_ID,LOG_DATE, ACTION) VALUES (USER,SYSDATE,'LOGGING ON '); END; / ------------------- TRACK BEFORE LOGOFF CREATE OR REPLACE TRIGGER LOGOFF_TRIG BEFORE LOGOFF ON SCHEMA BEGIN INSERT INTO LOG_TRIG_TABLE (USER_ID,LOG_DATE, ACTION) VALUES (USER,SYSDATE,'LOGGING OFF '); END; / -- Update CREATE OR REPLACE TRI...