Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

comparing CLOBs

523861Apr 20 2011 — edited May 4 2011
Hi all,

I have a brief question about comparing CLOBs.

I have not worked with clobs or blobs very much and have recently been reading the clob comparison rules section of the following:

http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14249/adlob_plsql_semantics.htm#sthref855

my question is, what is the difference between comparing a clob with another clob using the equals or not equals symbols and using dbms_lob.compare:

Database Version: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
Database Version: PL/SQL Release 10.2.0.5.0 - Production
begin

select *
  into val1, val2
  from foo;

  if val1 = val2 then
     dbms_output.put_line('equal');
  else
     dbms_output.put_line('not equal');
  end if;
  
  if dbms_lob.compare(val1,val2) = 0 then
     dbms_output.put_line('dbms_lob.compare equal');
  else
     dbms_output.put_line('dbms_lob.compare not equal');
  end if;
     

end; 
The above appears to give the same result for both regardless of how long the clob is (I've tried values up to 3mb)

What am I missing?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 1 2011
Added on Apr 20 2011
5 comments
3,599 views