I need to write SQL script which stops if some values not found in DB. Something like this (pseudo-code):
BEGIN;
...
set @a = (select ... );
if @a IS NULL THEN STOP_WITH_ERROR_AND_ROLLBACK();
...
COMMIT;
Can anybody help to me?
UPDATE: for some reasons, I can't use stored procedures or functions.
UPDATE 2: Note: I don't need explicit rollback. Break of script execution are sufficiently. It automatically rollback changes of not-committed transaction.