Chapter 9 SQL Statements
619
SIGNAL statement
Use this statement to signal an exception condition.
SIGNAL
exception-name
None.
None.
"DECLARE statement" on page 487
"RESIGNAL statement" on page 590
"BEGIN statement" on page 404
"Using exception handlers in procedures and triggers" on page 479 of the
book ASA User’s Guide
SIGNAL allows you to raise an exception. See "Using exception handlers in
procedures and triggers" on page 479 of the book ASA User’s Guide for a
description of how exceptions are handled.
exception-name The name of an exception declared using a DECLARE
statement at the beginning of the current compound statement. The exception
must correspond to a system-defined SQLSTATE or a user-defined
SQLSTATE. User-defined SQLSTATE values must be in the range 99000 to
99999.
♦
SQL/92 Persistent Stored Module feature.
♦
Sybase SIGNAL is not supported by Adaptive Server Enterprise.
The following compound statement declares and signals a user-defined
exception. If you execute this example from Interactive SQL, the message is
displayed in the Message window.
BEGIN
DECLARE myexception EXCEPTION
FOR SQLSTATE ’99001’;
SIGNAL myexception;
EXCEPTION
WHEN myexception THEN
MESSAGE ’My exception signaled’
TO CLIENT;
END
Function
Syntax
Permissions
Side effects
See also
Description
Standards and
compatibility
Examples