Compare two clobs : Clob « Data Type « Oracle PL / SQL






Compare two clobs

 
SQL> CREATE TABLE myTable (
  2    id          INTEGER PRIMARY KEY,
  3    clobData CLOB NOT NULL
  4  );

Table created.

SQL>
SQL> CREATE OR REPLACE PROCEDURE compare_example IS
  2    clobVariable1 CLOB;
  3    clobVariable2 CLOB;
  4    return_var INTEGER;
  5  BEGIN
  6    SELECT clobData INTO clobVariable1 FROM myTable WHERE id = 1;
  7    SELECT clobData INTO clobVariable2 FROM myTable WHERE id = 2;
  8
  9    return_var := DBMS_LOB.COMPARE(clobVariable1, clobVariable2);
 10    DBMS_OUTPUT.PUT_LINE('return_var = ' || return_var);
 11
 12    return_var := DBMS_LOB.COMPARE(clobVariable1, clobVariable1);
 13    DBMS_OUTPUT.PUT_LINE('return_var = ' || return_var);
 14  END compare_example;
 15  /

Procedure created.

SQL>
SQL> drop table myTable;

Table dropped.

   
  








Related examples in the same category

1.clob data type
2.Use clob type in PL/SQL
3.Use dbms_lob.erase to remove value from clob type value
4.Use dbms_lob.fileopen to open bfile
5.Creating an Internal LOB Table
6.Copying Internal LOBs
7.Appending and Writing to LOBs
8.DBMS_LOB package.
9.Print out the length of the CLOBs previously INSERTed
10.Compare clob data
11.Append data to clob
12.Assign string value to clob type variable
13.Clob type column
14.Copy clob data
15.In() function with clob data
16.Initialize clob
17.Read clob type data, DBMS_LOB.READ
18.Use between ... and with clob data
19.Use clob to store xml data
20.clob type data as string
21.erase clob data
22.use like operator with clob type data