Who Can Create an Exception
The CREATE EXCEPTION statement can be executed by:
-
Users with the
CREATE EXCEPTIONprivilege
The user executing the CREATE EXCEPTION statement becomes the owner of the exception.
The CREATE EXCEPTION statement can be executed by:
Users with the CREATE EXCEPTION privilege
The user executing the CREATE EXCEPTION statement becomes the owner of the exception.
CREATE EXCEPTION ExamplesE_LARGE_VALUECREATE EXCEPTION E_LARGE_VALUE
'The value is out of range';
E_INVALID_VALUECREATE EXCEPTION E_INVALID_VALUE
'Invalid value @1 for field @2';
ALTER EXCEPTIONAlters the default message of a custom exception
DSQL, ESQL
ALTER EXCEPTION exception_name '<message>'
!! See syntax of CREATE EXCEPTION for further rules !!
The ALTER EXCEPTION statement can be executed by:
The owner of the exception
Users with the ALTER ANY EXCEPTION privilege
ALTER EXCEPTION ExamplesE_LARGE_VALUEALTER EXCEPTION E_LARGE_VALUE
'The value exceeds the prescribed limit of 32,765 bytes';
CREATE OR ALTER EXCEPTIONCreates a custom exception if it doesn’t exist, or alters a custom exception
DSQL
CREATE OR ALTER EXCEPTION exception_name '<message>'
!! See syntax of CREATE EXCEPTION for further rules !!
The statement CREATE OR ALTER EXCEPTION is used to create the specified exception if it does not exist, or to modify the text of the error message returned from it if it exists already.If an existing exception is altered by this statement, any existing dependencies will remain intact.
CREATE OR ALTER EXCEPTION ExampleE_LARGE_VALUECREATE OR ALTER EXCEPTION E_LARGE_VALUE
'The value is higher than the permitted range 0 to 32,765';
DROP EXCEPTIONDrops a custom exception
DSQL, ESQL
DROP EXCEPTION exception_name
| Parameter | Description |
|---|---|
exception_name |
Exception name |
The statement DROP EXCEPTION is used to delete an exception.Any dependencies on the exception will cause the statement to fail, and the exception will not be deleted.
The DROP EXCEPTION statement can be executed by:
The owner of the exception
Users with the DROP ANY EXCEPTION privilege
DROP EXCEPTION ExamplesE_LARGE_VALUEDROP EXCEPTION E_LARGE_VALUE;
RECREATE EXCEPTIONDrops a custom exception if it exists, and creates a custom exception
DSQL
RECREATE EXCEPTION exception_name '<message>'
!! See syntax of CREATE EXCEPTION for further rules !!
The statement RECREATE EXCEPTION creates a new exception for use in PSQL modules.If an exception with the same name exists already, the RECREATE EXCEPTION statement will try to drop it and create a new one.If there are any dependencies on the existing exception, the attempted deletion fails and RECREATE EXCEPTION is not executed.
RECREATE EXCEPTION ExampleE_LARGE_VALUE exceptionRECREATE EXCEPTION E_LARGE_VALUE
'The value exceeds its limit';