Trigger updating same row

This Article will help you to understand “BEFORE UPDATE TRIGGER statement” with examples and it’s detailed description.

You will notice, in audit table, the old values are inserted. CREATE TABLE bank_transactions ( TXN_ID number(10) primary key, TXN_NUMBER varchar2(20), PARTY_NAME varchar2(50), TXN_DATE date, CREATED_BY varchar2(20), CREATED_DATE date ); --Creating bank_transactions_audit table. Then insert two rows in this table and observe the inserted values in DB.Update first_name column of both rows with some new value and then will observe the table data. UPDATED_DATE := sysdate; END; / -- setting date format to to 'DD-MON-YYYY' alter session set nls_date_format = 'DD-MON-YYYY'; INSERT INTO person_records VALUES (101,'Devil','Mark',sysdate,null,null); INSERT INTO person_records VALUES (102,'Finch','Andrew',sysdate,null,null); (3)Logging/Auditing data before UPDATE of the data.-- Creating TRIGGER CREATE OR REPLACE TRIGGER trg_before_emp_update BEFORE UPDATE OF JOB_EXPERIENCE, LAST_APPLIED_DATE on job_openings FOR EACH ROW DECLARE years_since_last_applied number(5); BEGIN years_since_last_applied := -1; IF(: NEW.LAST_APPLIED_DATE IS NOT NULL) THEN SELECT MONTHS_BETWEEN(TO_DATE(sysdate,'DD-MON-YYYY'), TO_DATE(: NEW.

Leave a Reply