Difference between revisions of "Oracle - comparing CLOB"

From ExxtremeWiki
Jump to: navigation, search
m
m
Line 36: Line 36:
  
 
--wkh 22:08, 5 April 2009 (UTC)
 
--wkh 22:08, 5 April 2009 (UTC)
Categories: Oracle | Data types
+
[[Categories: Oracle, Data types]]

Revision as of 20:22, 15 January 2012

Oracle - comparing CLOB [edit] Comparing CLOBs

What if you have two CLOB columns to compare? For example the maxpresentation table's presentation field...

A construct like

select someColumn from tab1 where col1 != col2

will not work.

This is what you will need to do to compare (using the maxpresentation table as an example):

  select a.app, a.presentation, b.presentation
      from maxpresentation a, maxpresentation_temp b
      where dbms_lob.compare(a.presentation, b.presentation) != 0

The return value is non-zero if the comparison fails. (or no rows selected)

I tested this by making a copy of the maxpresentation table

  create table maxpresentations_temp as select * from maxpresentation

and running it against the two tables. The first time I did this it did not complete and I discovered that there were missing text indexes on the Virtual Machine I was testing on (I'll add those references in a bit) - once I had all the right indexes in place it took around 1.4 seconds to complete... [edit] See also

   http://en.wikipedia.org/wiki/Clob
   Binary large object 

Template:Database-stub

nl:CLOB pl:CLOB


--wkh 22:08, 5 April 2009 (UTC) Categories: Oracle, Data types