Translate

File I/O Exception Handling

What are the Exceptions related to the UTL_FILE package?
To Read about- How UTL_FILE PACKAGE used to handle File I/O: Click here.

You many encounter a number of difficulties (and therefore raise exceptions) when working with Operating system files. Below are the exceptions you may want to handle in your programs when using the UTL_FILE package.
The UTL_FILE package itself offers a set of exceptions which are specific to the package. In addition, other pre-defined exceptions, such as NO_DATA_FOUND, take on a special significance in the context. Each of these exceptions are described below. Any exception which is prefaced with "UTL_FILE" is an exception defined in the package itself. Any exception handler must include the package name qualifier in order to properly trap (or compile) that exception reference.
Here is a sample exception section which references a number of the exceptions listed below:
EXCEPTION
                       WHEN NO_DATA_FOUND
                       THEN
                                              DBMS_OUTPUT ('Read past end of file...slow down!');
                                              WHEN UTL_FILE.INVALID_OPERATION
                       THEN
                                              DBMS_OUTPUT ('Cannot write to read-only file!');

END;



















Procedures in UTL_FILE can also raise predefined PL/SQL exceptions such as NO_DATA_FOUND or VALUE_ERROR.

No comments:

Post a Comment