Search This Blog

Tuesday, January 14, 2025

Audit Log Sample Trigger

 create or replace TRIGGER "SCHEMA"."UDS_CALL_LOG_INFO_BIU" 

    BEFORE INSERT OR UPDATE 
    ON "APEX_UDS"."UDS_CALL_LOG_INFO"
    FOR EACH ROW
BEGIN
    IF INSERTING THEN
       IF :NEW.MASTER_ID IS NULL THEN
           SELECT UDS_CALL_LOG_INFO_SEQ.NEXTVAL
           INTO :NEW.MASTER_ID
           FROM DUAL;
         END IF;

         :NEW.CREATED_DATE := LOCALTIMESTAMP;
         :NEW.CREATED_BY:=nvl(v('APP_USER'),USER);
    ELSIF UPDATING THEN 
         :NEW.EDIT_DATE := LOCALTIMESTAMP;
         :NEW.EDITED_BY:=nvl(v('APP_USER'),USER);
    END IF;
  EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line ('An error was encountered '||SQLCODE||' -ERROR- '||SQLERRM);
END UDS_CALL_LOG_INFO_BIU;

No comments:

Post a Comment

Interactive Grid Alternating Row Color

1. Put the CSS into Page properties Inline->  .customAlternatingRow .a-IRR-table tr:nth-child(odd) td{background-color:#bac3cc} .customAl...