tailieunhanh - Oracle Built−in Packages- P86
Oracle Built−in Packages- P86: 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 NULL Either amount offset_1oroffset_2 is less than 1 or amount offset_1 or offset_2is greater thanLOBMAXSIZE. Exceptions The COMPARE function may raise the following exceptions NOEXISTDIRECTORY For BFILEs. UNOPENEDFILE For BFILEs. Files must be open before comparison. NOPRIVDIRECTORY For BFILEs. INVALIDDIRECTORY For BFILEs. INVALIDOPERATION For BFILEs. Restrictions The program asserts a purity level with the RESTRICT_REFERENCES pragma. PRAGMA RESTRICT_REFERENCES compare WNDS RNDS WNPS RNPS Examples The following example compares two BFILE locators that are pointing to the same file. Note that for BFILEs we must provide a number of bytes in the amount parameter to compare which is determined via the GETLENGTH function. Note also that for BFILES we must first open the files. DECLARE v_file_loc_1 BFILE v_file_1_length INTEGER v_file_loc_2 BFILE BEGIN v_file_loc_1 BFILENAME IMAGES v_file_loc_2 BFILENAME IMAGES v_file_loc_1 v_file_loc_2 v_file_1_length v_file_loc_1 IF v_file_loc_1 v_file_loc_2 v_file_1_length 0 THEN file_loc_1 equals file_loc_2 ELSE file_loc_1 is not equal to file_loc_2 END IF END Reading and Examining LOBs 416 Appendix A What s on the Companion Disk This is the output of the script file_loc_1 equals file_loc_2 This example compares two diagrams from the my_book_diagrams table DECLARE CURSOR diagram_cur num IN INTEGER IS SELECT diagram FROM my_book_diagrams WHERE chapter_descr Chapter 1 AND diagram_no num v_diagram_1_loc BLOB v_diagram_2_loc BLOB BEGIN OPEN diagram_cur 1 FETCH diagram_cur INTO v_diagram_1_loc CLOSE diagram_cur OPEN diagram_cur 2 FETCH diagram_cur INTO v_diagram_1_loc CLOSE diagram_cur IF v_diagram_1_loc v_diagram_2_loc 0 THEN diagrams are equal ELSE .
đang nạp các trang xem trước