Tutorial 15 : DML TRIGGER || How to use TRIGGER to audit the table.

แชร์
ฝัง
  • เผยแพร่เมื่อ 10 พ.ย. 2024

ความคิดเห็น • 3

  • @fip4070
    @fip4070 3 ปีที่แล้ว

    Your Presentation is very helpful .. Thanks.

  • @vamshikrishna9204
    @vamshikrishna9204 ปีที่แล้ว

    Before trigger means the trigger is fired before inserting table is it correct sir

  • @DeepakKumar-nq6cq
    @DeepakKumar-nq6cq 6 ปีที่แล้ว

    CREATE OR REPLACE TRIGGER biud_Emp1
    BEFORE INSERT OR UPDATE OR DELETE ON Emp1
    FOR EACH ROW
    DECLARE
    v_date varchar2(100);
    BEGIN
    SELECT SYSDATE INTO v_date FROM DUAL;
    IF inserting then
    insert into emp_Audit(new_Name, Old_Name, created_on, operation)
    VALUES (:new.name, null, v_date, 'insert');
    elsif updating then
    insert into emp_Audit(new_Name, Old_Name, created_on, operation)
    VALUES (:new.name, :OLD.name, v_date, 'update');
    elsif deleting then
    insert into emp_Audit(new.Name, Old_Name, created_On, Operation)
    VALUES(null, :OLD.Name, v_date, 'delete');
    END IF;
    END;
    ** Can u check, where I did mistake