11.20.Handling Conditions In Virtuoso/PL
Condition handlers determine the behavior of a Virtuoso/PL
procedure when a condition occurs. You can declare one or more
condition handlers in your Virtuoso/PL procedure for general SQL
conditions or specific SQLSTATE values.
If a statement in your procedure raises an SQLEXCEPTION
condition and you declared a handler for the specific SQLSTATE or
SQLEXCEPTION condition the server passes control to that
If a statement in your Virtuoso/PL procedure raises an
SQLEXCEPTION condition, and you have not declared a handler for the
specific SQLSTATE or the SQLEXCEPTION condition, the server passes
the exception to the calling procedure (if any). If the procedure
call is at the top-level, then the exception is signalled to the
Handlers are active only for the duration of the enclosing
compound statement. When an exception is thrown outside the
handler's scope then this handler is never called.