Pervasive logo

Prev SQL Engine Reference Next

SIGNAL


Remarks

The SIGNAL statement allows you to signal an exception condition or a completion condition other than successful completion.

Signalling an SQLSTATE value causes SQLSTATE to be set to a specific value. This value is then returned to the user, or made available to the calling procedure (through the SQLSTATE value). This value is available to the application calling the procedure.

SIGNAL is available only inside a stored procedure.

Examples

The following example prints the initial SQLSTATE value "00000," then prints "SQLSTATE exception caught" after the signal is raised. The final SQLSTATE value printed is "W9001." 
CREATE PROCEDURE GenerateSignal(); 
BEGIN 
SIGNAL 'W9001'; 
END; CREATE PROCEDURE TestSignal() WITH DEFAULT HANDLER; BEGIN
PRINT SQLSTATE; 
CALL GenerateSignal(); 
IF SQLSTATE <> '00000' THEN 
PRINT 'SQLSTATE exception caught'; 
END IF; PRINT SQLSTATE;
END;

See Also

CREATE PROCEDURE


Prev
SET VARIABLE
Contents
Up
Check for Revisions
Next
SQLSTATE