PLSQL :NEW and :OLD

前端 未结 13 1163
孤街浪徒
孤街浪徒 2020-12-24 06:30

Can anyone help me understand when to use :NEW and :OLD in PLSQL blocks, I\'m finding it very difficult to understand their usage.

13条回答
  •  自闭症患者
    2020-12-24 07:06

    In simple way,

    Trigger will fire when you manipulate data into table. so while trigger invoke, you have both value. one is referring to old data value and one is the new data value which you recently update/delete/insert. in-case of

    insert- old value would be null and new value contain some value update - old and new both have some value delete - old has value but new will not contain value.

    so by using :OLD and :NEW, you can insert/update other table where you want to maintain your history or based on :OLD or :NEW value you can insert/update some other dependent table.

    Hopefully this helps you..

提交回复
热议问题