Please be aware that the SAP SQL Anywhere Forum will be shut down on August 29th, 2024 when all it's content will be migrated to the SAP Community.

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?

asked 15 Jul '13, 12:17

judy's gravatar image

accept rate: 0%

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.

permanent link

answered 15 Jul '13, 12:26

Volker%20Barth's gravatar image

Volker Barth
accept rate: 34%

(15 Jul '13, 13:15) Breck Carter
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 15 Jul '13, 12:17

question was seen: 2,561 times

last updated: 15 Jul '13, 13:15