Special Error Number -746

The special error number -746 allows you to produce a customized message. For example, the following statement raises the error number -746 and returns the quoted text:
RAISE EXCEPTION -746, 0, 'You broke the rules';
In the following example, a negative value for alpha raises exception -746 and provides a specific message that describes the problem. The code should contain an ON EXCEPTION statement that traps for an exception of -746.
FOREACH SELECT c1 INTO alpha FROM sometable
IF alpha < 0 THEN
RAISE EXCEPTION -746, 0, 'a < 0 found' -- emergency exit
END IF
END FOREACH
When the SPL routine executes and the IF condition is met, the database server returns the following error:
-746: a < 0 found.

For more information about the scope and compatibility of exceptions, see ON EXCEPTION.

Related Statements

ON EXCEPTION