|
Re: Want more info about Raise_Application_Error Func. [message #370433 is a reply to message #370431] |
Fri, 24 September 1999 09:10 |
Mario
Messages: 10 Registered: September 1999
|
Junior Member |
|
|
Here's an example of how I use it:
PROCEDURE toto
IS
f UTL_FILE.FILE_TYPE := NULL;
step VARCHAR(200);
BEGIN
step := 'Step 1 : FOPEN ';
f := UTL_FILE.FOPEN('/develop/rtdas/v6.0/log', 'toto.txt', 'a');
step := 'Step 2 : PUT_LINE ';
UTL_FILE.PUT_LINE(f, 'test from toto ' || sysdate);
step := 'Step 3 : FCLOSE ';
UTL_FILE.FCLOSE(f);
step := 'Step 4 : end ';
EXCEPTION
WHEN UTL_FILE.INVALID_PATH THEN
RAISE_APPLICATION_ERROR(-20000, step || ' : INVALID_PATH');
WHEN UTL_FILE.INVALID_MODE THEN
RAISE_APPLICATION_ERROR(-20000, step || ' : INVALID_MODE');
WHEN UTL_FILE.INVALID_FILEHANDLE THEN
RAISE_APPLICATION_ERROR(-20000, step || ' : INVALID_FILEHANDLE');
WHEN UTL_FILE.INVALID_OPERATION THEN
RAISE_APPLICATION_ERROR(-20000, step || ' : INVALID_OPERATION');
WHEN UTL_FILE.READ_ERROR THEN
RAISE_APPLICATION_ERROR(-20000, step || ' : READ_ERROR');
WHEN UTL_FILE.WRITE_ERROR THEN
RAISE_APPLICATION_ERROR(-20000, step || ' : WRITE_ERROR');
WHEN UTL_FILE.INTERNAL_ERROR THEN
RAISE_APPLICATION_ERROR(-20000, step || ' : INTERNAL_ERROR');
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR(-20000, step || TO_CHAR(SQLCODE) || ': ' || SQLERRM);
END toto;
|
|
|
|