New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The stored procedure can not inactive Trigger [CORE4023] #4353
Comments
Commented by: @dyemanov It's not going to work because every DDL (including activating/disactivating indices) is actually executed on commit, so you cannot do it in the middle of transaction. That said, I suppose you could workaround that using an autonomous transaction. |
Commented by: KAOUANE (kaouane) Thank you very much; |
Modified by: @pcisarstatus: Resolved [ 5 ] => Closed [ 6 ] |
Commented by: @dyemanov Commit is not allowed in triggers either. |
Commented by: KAOUANE (kaouane) Yes it is, thank you very much. |
Commented by: KAOUANE (kaouane) I have found very good solution for this problem. IF (rdb$get_context(''USER_SESSION'', ''PROCEDURE'')=1) THEN EXIT; And at Begin of SP I put : RDB$SET_CONTEXT(''USER_SESSION'',''PROCEDURE'',1); and at last I put : RDB$SET_CONTEXT(''USER_SESSION'',''PROCEDURE'',0); This way permet to execute SP without execution of trigger specialy for currentuser. |
Commented by: @asfernandes I believe it's better to use USER_TRANSACTION instead of USER_SESSION in your case. |
Commented by: KAOUANE (kaouane) I believe it's same because the value of 'procedure' are value 1 just in SP transaction. |
Submitted by: KAOUANE (kaouane)
I have trigger MDF_VEHICULE active on after update table;
I have a stored procedure who update this table but I want to diactive trigger inside this procedure and activate it at last.
In core of SP I write :
EXECUTE STATEMENT 'ALTER TRIGGER MDF_VEHICULE INACTIVE';
UPDATE VEHICULE SET VALIDE = 1;
....
EXECUTE STATEMENT 'ALTER TRIGGER MDF_VEHICULE ACTIVE';
When I execute SP, I find that trigger are not inactive.
The text was updated successfully, but these errors were encountered: