Hi,
I want to know if exists some function to disabled a trigger during the execution of my script and then other function to enable it.
I have a script that make some changes and I have a trigger that start with one of those changes. I'd like that doesn't execute the trigger if the change is with my script, so I was thinking in disabled the trigger in the begining of my script and enable it at the end of the script.
it is possible?
Thank you! Juanfergar - Tue Jul 02 02:53:22 EDT 2019 |
Re: Disable/enable trigger See https://www.ibm.com/developerworks/community/forums/html/topic?id=efff3796-f46f-4e8d-b2ee-b7cb73772df1 for a discussion and some possible workarounds/solutions. Have a look especially at the last comment which recommends rethinking your trigger strategy. |
Re: Disable/enable trigger I do see "enable(Trigger)" and "disable(Trigger)" DXL perms, but have never seen them before. I'm guessing they only work on Dynamic triggers. In any event it would be difficult to write a DXL to disable specific triggers.
bool State = getTriggerState_() // This returns the state of the flag; not whether it works. Even when this returns false, triggers still run for non-DB admins.
In your case, however, I think the Trigger code needs to be clever and know when to do nothing when invoked. Here are some possibilities: If we presume you did that last one, your on-demand script can do this: bool StatePrev = getTriggerState() setTriggerState(false) make your updates setTriggerState(StatePrev) -Louie |