on 2013 Jul 15 1:17 PM
Based on code in a trigger I want to stop the insert or update that triggered it to fail. Since this is an atomic statement, can this be done at the database level?
Request clarification before answering.
Just call ROLLBACK TRIGGER within the trigger under the according condition.
To cite from the docs:
The ROLLBACK TRIGGER statement rolls back the work done in a trigger, including the data manipulation that caused the trigger to fire.
Optionally, a RAISERROR statement can executed. If a RAISERROR statement is executed, an error is returned to the application. If no RAISERROR statement is executed, no error is returned.
If a ROLLBACK TRIGGER statement is used within a nested trigger and without a RAISERROR statement, only the innermost trigger and the statement which caused it to fire are undone.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
...and here's an example: http://sqlanywhere.blogspot.ca/2009/02/one-row-only.html
User | Count |
---|---|
54 | |
6 | |
6 | |
5 | |
5 | |
5 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.