SHARE
TWEET

Untitled

a guest Oct 12th, 2017 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE OR REPLACE TRIGGER AUDIT_REC
  2. AFTER INSERT OR DELETE OR UPDATE ON EMPLOYEE_T, SKILL_T
  3. FOR EACH ROW
  4. DECLARE
  5.   V_LOGID NUMBER;
  6.     V_USER  VARCHAR(30);
  7.     V_DATE  VARCHAR(30);
  8.  
  9. BEGIN
  10.   SELECT EVENTLOG_ID_SEQ.NEXTVAL, USER, SYSDATE INTO V_LOGID, V_USER, V_DATE FROM DUAL;
  11.   IF INSERTING THEN
  12.     INSERT INTO EVENTLOGS(Eventlog_id, User_name, Date_done, Action_done)
  13.     VALUES (V_LOGID, V_USER, V_DATE, 'INSERT');
  14.   ELSIF DELETING THEN
  15.     INSERT INTO EVENTLOGS(Eventlog_id, User_name, Date_done, Action_done)
  16.     VALUES (V_LOGID, V_USER, V_DATE, 'DELETE');
  17.   ELSIF UPDATING THEN
  18.     INSERT INTO EVENTLOGS(Eventlog_id, User_name, Date_done, Action_done)
  19.     VALUES (V_LOGID, V_USER, V_DATE, 'UPDATE');
  20.   END IF;
  21. END;
  22. /
RAW Paste Data
Top