Firebird Documentation IndexFirebird 3.0.6 Release NotesProcedural SQL (PSQL) → SQLSTATE in Exception Handlers
Firebird Home Firebird Home Prev: Extension of Colon Prefix UsageFirebird Documentation IndexUp: Procedural SQL (PSQL)Next: EXECUTE BLOCK Run-time Errors

SQLSTATE in Exception Handlers

Dmitry Yemanov

An SQLSTATE code becomes a valid condition for trapping an exception with a WHEN statement. In alignment with SQLCODE and GDSCODE, the SQLSTATE code can be used as in the following snippet:

...
WHEN SQLSTATE '22006' DO
BEGIN
  -- do something
END
...
      

Note

SQLSTATE codes are string literals.

Prev: Extension of Colon Prefix UsageFirebird Documentation IndexUp: Procedural SQL (PSQL)Next: EXECUTE BLOCK Run-time Errors
Firebird Documentation IndexFirebird 3.0.6 Release NotesProcedural SQL (PSQL) → SQLSTATE in Exception Handlers