RAISE EXCEPTION
Use the RAISE EXCEPTION statement to simulate the generation of an error.
Syntax
Element | Description | Restrictions | Syntax |
---|---|---|---|
error_text | SPL variable or expression that contains error message text for error -746 | Must be a character data type and be valid in the statement block | Identifier; Expression |
ISAM_error | SPL variable or other expression that represents
an ISAM error number. The default is 0 . |
Must return a value in SMALLINT range. You can specify a unary minus sign before error number. | Expression |
SQL_error | SPL variable or other expression that represents an SQL error number | Same as for ISAM_error | Expression |
Usage
Use the RAISE EXCEPTION statement to simulate an error or to generate an error with a custom message. An ON EXCEPTION statement can trap the generated error.
If
you omit ISAM_error, the database server sets the ISAM error
code to zero (0
) when the exception is raised. If
you want to specify error_text but not specify a value for ISAM_error,
specify zero (0
) as the value of ISAM_error.
-208
: RAISE EXCEPTION -208, 0;
Here the minus ( - ) symbol is required after the EXCEPTION keyword for error -208; most error codes are negative integers.