new and old trigger code

后端 未结 4 1060
长情又很酷
长情又很酷 2020-12-30 14:53

can someone please explain what is meant by:

:new and :old in trigger code.

4条回答
  •  佛祖请我去吃肉
    2020-12-30 15:37

    In Plain English:

    They are aliases that allow you to access information from how a column was (old) and how it will be (new).

    From Oracle documentation:

    Old and new values are available in both BEFORE and AFTER row triggers. A new column value can be assigned in a BEFORE row trigger, but not in an AFTER row trigger (because the triggering statement takes effect before an AFTER row trigger is fired). If a BEFORE row trigger changes the value of new.column, then an AFTER row trigger fired by the same statement sees the change assigned by the BEFORE row trigger.

    Correlation names can also be used in the Boolean expression of a WHEN clause. A colon must precede the old and new qualifiers when they are used in a trigger's body, but a colon is not allowed when using the qualifiers in the WHEN clause or the REFERENCING option.

提交回复
热议问题