What is Raise Application_Error
The procedure RAISE_APPLICATION_ERROR lets user to issue user-defined ORA- error messages from stored subprograms. That way, user can report errors to your
application and avoid returning unhandled exceptions.
the syntax is
raise_application_error(error_number, message[, {TRUE | FALSE}]);
DECLARE
num_of_employees NUMBER;
BEGIN
SELECT COUNT (*)
INTO num_of_employees
FROM employee;
IF num_of_employees < 100
THEN
/* Issue your own error code (ORA-20509) with your own error message. */
raise_application_error (- 20509, 'Expecting at least 100 employees');
ELSE
NULL; -- Do the rest of the processing (for the non-error case).
END IF;
END;
0 comments:
Post a Comment