Can an Oracle trigger be disabled for the current session?

前端 未结 4 1071
日久生厌
日久生厌 2021-02-19 16:28

I\'d like to disable a specific trigger on a table prior to inserting data into it, but without affecting other users that may be changing data in that same tab

4条回答
  •  無奈伤痛
    2021-02-19 17:07

    Add a variable to an existing package spec (or create a new package):

    enable_trigger boolean := true;

    Surround the code in the trigger with:

    if enable_trigger then
    
    end if;

    When you want to "disable" the trigger set the variable to false.

    A Best Practice would be to put the variable in the body and write a set procedure and a get function.

提交回复
热议问题