SIGNAL

Raises the specified exception condition.

signal.png

 

where signal-information is:

signal_information.png

 

Usage

Procedural.

Description

The SIGNAL statement has the effect of raising an exception condition specified by an SQLSTATE value or a condition name.

If a condition identifier is used in the statement the associated SQLSTATE value is raised. If the condition identifier is declared without an SQLSTATE value, the SQLSTATE 45000 is raised. If there is an appropriate exception handler for this SQLSTATE, this handler will be invoked otherwise the SQLSTATE is propagated to the calling environment.

It is possible to provide diagnostics information with the signal statement. This diagnostics information can be retrieved where the exception is handled. This can be used to customize error messages for an application. The signal-information fields are described in the GET DIAGNOSTICS section condition-info Information Items.

Note that an SQLSTATE value corresponding to a warning condition that is not catched by an exception handler will not be propagated to the calling environment.

Notes

See DECLARE CONDITION for a description of how to declare a condition name.

Example

signal sqlstate 'UE324'

   set message_text = 'A horse named ' || horse_name ||

                      ' already exists in the database';

 

For more information, see the Mimer SQL Programmer's Manual, SIGNAL Statements.

Standard Compliance

Standard

Compliance

Comments

SQL-2016

Features outside core

Feature P002, “Computational completeness”.