On 14.05.2024 at 14:19, Giovanni Bucci wrote:
> I am trying now with ISQL to create and exception and a trigger that raise
> that exception on a specific condition,
> then still from isql i run a transaction to make an update and inside the
> isql i try to catch the exception and rollback
> the transaction based on the exception the trigger raise.
In isql you execute START TRANSACTION, then some other statements and
after them either COMMIT or ROLLBACK. If a statement causes an exception
(e.g. one raised by a trigger), you can see the exception directly in
isql output. When an exception appears, you can still execute COMMIT or
ROLLBACK (according to your liking). isql won't do anything
automatically - it's your decision what to do when you see a query
resulting in an error.
In Delphi the exception from the database will be (I assume you're going
to use some kind of DB components library like IBX, IBO or FireDAC)
thrown as Object Pascal exception, and you should use a standard try ...
except construct to detect and handle those exceptions (you can roll
back the transaction in the except clause for example).
regards
Tomasz