Subject | Re: [firebird-support] Is it possible to deactive a trigger from within a stored procedure? |
---|---|
Author | Helen Borrie |
Post date | 2015-09-11T01:50:36Z |
At 08:21 a.m. 11/09/2015, 'stwizard' stwizard@... [firebird-support] wrote:
But
ALTER TRIGGER...INACTIVE
COMMIT
EXECUTE PROCEDURE....
COMMIT
ALTER TRIGGER ... ACTIVE
COMMIT
--yes. Just make sure the user has exclusive access to the database, though.
Better to write a trigger that won't fire under some specified condition, e.g., you create the procedure that only user VERYSPECIAL can execute; and write the trigger so
if (current_user = VERYSPECIAL) then EXIT;
(Assuming of course that you don't have people logging in willy-nilly as SYSDBA or Owner of the procedure...)
Helen
>Firebird v1.5.3All in a stored procedure? No. ALTER TRIGGER is DDL and you can't run DDL in a PSQL module in v.1.5. You actually can in later versions, using EXECUTE STATEMENT, but you shouldn't. EXECUTE STATEMENT gives fools enough rope to hang themselves.
>
>Is it possible to deactive a trigger on a table, then process some code inside the stored procedure and then reactivate the trigger when done?
But
ALTER TRIGGER...INACTIVE
COMMIT
EXECUTE PROCEDURE....
COMMIT
ALTER TRIGGER ... ACTIVE
COMMIT
--yes. Just make sure the user has exclusive access to the database, though.
Better to write a trigger that won't fire under some specified condition, e.g., you create the procedure that only user VERYSPECIAL can execute; and write the trigger so
if (current_user = VERYSPECIAL) then EXIT;
(Assuming of course that you don't have people logging in willy-nilly as SYSDBA or Owner of the procedure...)
Helen