Đang chuẩn bị liên kết để tải về tài liệu:
Oracle Built−in Packages- P73
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Oracle Built−in Packages- P73: Ah, for the good old days of Version 1.0 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 3.0, and you went home at night content with a good day's work done. | Appendix A What s on the Companion Disk UTL_FILE.WRITE_ERROR 6.2.5.2 The UTL_FILE.FCLOSE_ALL procedure FCLOSE_ALL closes all of the opened files. The header for this procedure follows PROCEDURE UTL_FILE.FCLOSE_ALL 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 UTL_FILE.FCLOSE_ALL . 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 . 6.2.5.2.1 Exceptions FCLOSE_ALL may raise the following exception UTL_FILE.WRITE_ERROR 6.2.6 Tips on Using UTL_FILE This section contains a variety of tips on using UTL_FILE to its full potential. 6.2.6.1 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 UTL_FILE.INVALID_FILEHANDLE. 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 UTL_FILE.FILE_TYPE BEGIN fileID UTL_FILE.FOPEN c tmp lotsa.stf R UTL_FILE.PUT_LINE fileID just the beginning UTL_FILE.FCLOSE fileID END It is filled with .