At 08:21 a.m. 11/09/2015, 'stwizard' [email protected] [firebird-support] wrote:


>Firebird v1.5.3
> 
>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?

All 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.

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

Reply via email to