I\'m trying to do some checkings on a DB schema at the beginning of a PL/SQL script.
If the checkings give unsuccessful results, I want to stop the script, to prevent th
A few more seconds of googling gave me the answer: the function RAISE_APPLICATION_ERROR()
IF (SOME_COUNT > 0) THEN
RAISE_APPLICATION_ERROR(-20000, 'Test failed');
END IF;
The user-defined error code should be between -20000 and -20999.
Details on Oracle doc here: http://docs.oracle.com/cd/B10501_01/appdev.920/a96624/07_errs.htm#877 (section Defining Your Own Error Messages: Procedure RAISE_APPLICATION_ERROR)