tailieunhanh - Oracle Built−in Packages- P84
Oracle Built−in Packages- P84: 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 Parameters are summarized in the following table. Parameter Purpose file_loc File locator for the file to be opened open_mode Indicates that file access will be read-only this parameter can be omitted from calls to FILEOPEN because the program assigns a default value of FILE_READONLY Exceptions The following types of exceptions can be raised by the FILEOPEN procedure NOEXIST_DIRECTORY The directory alias associated with file_loc does not exist. OPENTOOMANY The number of open files exceeds the SESSION_MAX_OPEN_FILES limit. INVALIDARGVAL The open_mode value is not FILE_READONLY. INVALID_OPERATION The file does not exist or the user does not have privileges to access the file. VALUE_ERROR The file_loc parameter contains an improper value . NULL . Examples This example uses the FILEOPEN procedure to check whether exists in the BOOK_TEXT directory then opens and closes the file DECLARE book_file_loc BFILE NULL book_file_exists BOOLEAN FALSE BEGIN book_file_loc BFILENAME BOOK_TEXT book_file_exists book_file_loc 1 IF book_file_exists THEN exists opening the file book_file_loc closing the file book_file_loc END IF END This is the output of the script exists opening the file closing the file Working with BFILEs 406 Appendix A What s on the Companion Disk The FILEOPEN procedure raises a VALUE_ERROR exception when passed to a NULL file. The procedure raises a NOEXIST_DIRECTORY exception when passed to a file locator associated with a nonexistent directory alias. Note that it is possible to open the same file using two different file locators for example DECLARE book_file_loc_1 book_file_loc_2 book file exists BFILE NULL BFILE NULL BOOLEAN FALSE BEGIN book_file_loc_1 BFILENAME BOOK_TEXT book_file_loc_2 BFILENAME BOOK_TEXT
đang nạp các trang xem trước