Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » SQL Anywhere Server - SQL Reference » SQL statements » Alphabetical list of SQL statements

SIGNAL statement [SP]

Signals an exception condition.

Syntax
SIGNAL exception-name
Remarks

SIGNAL allows you to raise an exception.

Use exception-name to specify 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.

Privileges

None.

Side effects

None.

Standards
  • ANSI/ISO SQL Standard

    The SIGNAL statement is part of optional ANSI/ISO SQL Language Feature P002, "Computational completeness".

  • Transact-SQL

    The SIGNAL statement cannot be used in Transact-SQL compound statements and procedures.

Example

The following compound statement declares and signals a user-defined exception. If you execute this example from Interactive SQL, the message 'My exception signaled' appears on the History tab in the Results area.

BEGIN
   DECLARE myexception EXCEPTION
   FOR SQLSTATE '99001';
   SIGNAL myexception;
   EXCEPTION
      WHEN myexception THEN
         MESSAGE 'My exception signaled'
         TO CLIENT;
END