tags:

views:

1002

answers:

2

I have two tables I would like to complare. One of the columns is type glob. I would like to do something like this:

select key, glob_value source_table
minus
select key, glob_value target_table

Unfortunately, Oracle can't perform minus operations on globs. How can I do this?

A: 

Can you access the data via a built in package? If so then perhaps you could write a function that returned a string representation of the data (eg some sort of hash on the data), then you could do

select key, to_hash_str_val(glob_value) from source_table
minus
select key, to_hash_str_val(glob_value) from target_table
hamishmcn
+1  A: 

The format is this:

dbms_lob.compare(  
lob_1    IN BLOB,  
lob_2    IN BLOB,  
amount   IN INTEGER := 18446744073709551615,  
offset_1 IN INTEGER := 1,  
offset_2 IN INTEGER := 1)  
RETURN INTEGER;


If dbms_lob.compare(lob1, lob2) = 0, they are identical.

Here's an example query based on your example:

Select key, glob_value  
From source_table Left Join target_table  
  On source_table.key = target_table.key  
Where target_table.glob_value is Null  
  Or dbms_lob.compare(source_table.glob_value, target_table.glob_value) <> 0
Nick Craver