Oracle9i Supplied PL/SQL Packages and Types Reference Release 1 (9.0.1) Part Number A89852-02 |
|
DBMS_LOB , 4 of 26
This function compares two entire LOBs
or parts of two LOBs
. You can only compare LOBs
of the same datatype (LOBs
of BLOB
type with other BLOBs
, and CLOBs
with CLOBs
, and BFILEs
with BFILEs
). For BFILEs
, the file must be already opened using a successful FILEOPEN
operation for this operation to succeed.
COMPARE
returns zero if the data exactly matches over the range specified by the offset
and amount
parameters. Otherwise, a non-zero INTEGER
is returned.
For fixed-width n-byte CLOBs
, if the input amount for COMPARE
is specified to be greater than (4294967295/n), then COMPARE
matches characters in a range of size (4294967295/n), or Max(length(clob1), length(clob2)), whichever is lesser.
DBMS_LOB.COMPARE ( lob_1 IN BLOB, lob_2 IN BLOB, amount IN INTEGER := 4294967295, offset_1 IN INTEGER := 1, offset_2 IN INTEGER := 1) RETURN INTEGER; DBMS_LOB.COMPARE ( lob_1 IN CLOB CHARACTER SET ANY_CS, lob_2 IN CLOB CHARACTER SET lob_1%CHARSET, amount IN INTEGER := 4294967295, offset_1 IN INTEGER := 1, offset_2 IN INTEGER := 1) RETURN INTEGER; DBMS_LOB.COMPARE ( lob_1 IN BFILE, lob_2 IN BFILE, amount IN INTEGER, offset_1 IN INTEGER := 1, offset_2 IN INTEGER := 1) RETURN INTEGER;
pragma restrict_references(COMPARE, WNDS, WNPS, RNDS, RNPS);
CREATE OR REPLACE PROCEDURE Example2a IS lob_1, lob_2 BLOB; retval INTEGER; BEGIN SELECT b_col INTO lob_1 FROM lob_table WHERE key_value = 45; SELECT b_col INTO lob_2 FROM lob_table WHERE key_value = 54; retval := dbms_lob.compare(lob_1, lob_2, 5600, 33482, 128); IF retval = 0 THEN ; -- process compared code ELSE ; -- process not compared code END IF; END; CREATE OR REPLACE PROCEDURE Example_2b IS fil_1, fil_2 BFILE; retval INTEGER; BEGIN SELECT f_lob INTO fil_1 FROM lob_table WHERE key_value = 45; SELECT f_lob INTO fil_2 FROM lob_table WHERE key_value = 54; dbms_lob.fileopen(fil_1, dbms_lob.file_readonly); dbms_lob.fileopen(fil_2, dbms_lob.file_readonly); retval := dbms_lob.compare(fil_1, fil_2, 5600, 3348276, 2765612); IF (retval = 0) THEN ; -- process compared code ELSE ; -- process not compared code END IF; dbms_lob.fileclose(fil_1); dbms_lob.fileclose(fil_2); END;
|
Copyright © 1996-2001, Oracle Corporation. All Rights Reserved. |
|