tailieunhanh - Oracle Built−in Packages- P73

Oracle Built−in Packages- P73: Ah, for the good old days of Version of PL /SQL! Life was so simple then. No stored procedures or functions and certainly no packages. You had your set of built−in functions, like SUBSTR and TO_DATE. You had the IF statement and various kinds of loops. With these tools at hand, you built your batch−processing scripts for execution in SQL*Plus, and you coded your triggers in SQL*Forms , and you went home at night content with a good day's work done. | Appendix A What s on the Companion Disk The procedure FCLOSE_ALL closes all of the opened files. The header for this procedure follows PROCEDURE This procedure will come in handy when you have opened a variety of files and want to make sure that none of them are left open when your program terminates. In programs in which files have been opened you should also call FCLOSE_ALL in exception handlers in programs. If there is an abnormal termination of the program files will then still be closed. EXCEPTION WHEN OTHERS THEN . other clean up activities . END NOTE When you close your files with the FCLOSE_ALL procedure none of your file handles will be marked as closed the id field in other words will still be non-NULL . The result is that any calls to IS_OPEN for those file handles will still return TRUE. You will not however be able to perform any read or write operations on those files unless you reopen them . Exceptions FCLOSE_ALL may raise the following exception Tips on Using UTL_FILE This section contains a variety of tips on using UTL_FILE to its full potential. Handling file I O errors You may encounter a number of difficulties and therefore raise exceptions when working with operating system files. The good news is that Oracle has predefined a set of exceptions specific to the UTL_FILE package such as . The bad news is that these are all user-defined exceptions meaning that if you call SQLCODE to see what the error is you get a value of 1 regardless of the exception. And a call to SQLERRM returns the less-than-useful string User-Defined Exception. To understand the problems this causes consider the following program PROCEDURE file_action IS fileID BEGIN fileID c tmp R fileID just the beginning fileID END It is filled with .