Skip to main content
Skip table of contents

Errors and Messages

Error Statement

An ERROR statement declares that the procedure has entered an error state and should abort. This statement will also roll back the current transaction if one exists. Any valid expression can be specified after the ERROR keyword.

Usage

ERROR message;

Example

SQL
BEGIN
    ...
    ERROR 'Invalid input value: ' || nvl(Acct.GetBalance.AcctID, 'null');
END


An ERROR statement is equivalent to the following statement:

SQL
RAISE SQLEXCEPTION message;

Raise Statement

A RAISE statement is used to raise an exception or warning. When raising an exception, this statement will also roll back the current transaction, if one exists.

Usage

SQL
RAISE [SQLWARNING] exception;

Where exception may be a variable reference to an exception or an exception expression.

Syntax

  • If SQLWARNING is specified, the exception will be sent to the client as a warning, and the procedure will continue to execute;
  • A null warning will be ignored. A null non-warning exception will still cause an exception to be raised.


Example

SQL
BEGIN
    RAISE SQLWARNING SQLEXCEPTION 'invalid' SQLSTATE '05000';
END

Exception Expression

An exception expression creates an exception that can be raised or used as a warning.

Usage

SQL
SQLEXCEPTION message [SQLSTATE state [, code]] CHAIN exception

Syntax

  • Any of the values may be null;
  • Message and state are string expressions specifying the exception message and SQL state, respectively. The Data Virtuality Server does not yet fully comply with the ANSI SQL specification on SQL state usage, but you are allowed to set any SQL state you choose;
  • Code is an integer expression specifying the vendor code;
  • Exception must be a variable reference to an exception or an exception expression and will be chained to the resulting exception as its parent.
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.