Using a packaged procedure:
RAISE_APPLICATION_ERROR(error number,’Error message’);
RAISE APPLICATION ERROR:
RAISE_APPLICATION_ERROR(error number,’Error message’);
RAISE APPLICATION ERROR:
- This Built-in procedure is used to create your own error message, which can be more descriptive than named exceptions.
- It is used to communicate a predefined exception interactively by returning a non standard error code and error message.
- Using this procedure we can report error to application and avoid returning unhandled exception.
Note:
- Error number must exists between -20,000 and -20,999
- Error_message is the text associate with this error, and keep_errors is Boolean value.
- The error_message parameter must be less than 512 characters.
SQLCODE FUNCTION:
- It returns the current error code.
- For a user defined exception it returns 1, +100 NO_DATA_FOUND exception.
SQLERRM:
- It returns the current error message text.
- SQLERRM returns the message associated with the error number.
- The maximum length of a message returned by the SQLERRM functions is 512 bytes.
0 comments: