I have two tables I would like to complare. One of the columns is type CLOB. I would like to do something like this:
select key, clob_value source_table
minus
select key, clob_value target_table
Unfortunately, Oracle can't perform minus operations on clobs. How can I do this?
Try this: declare Data1 Clob; begin Data1 := 'ab c d'; -- replace all the whitespace in Data1 with null if dbms_lob. getlength(regexp_replace(Data1,'[[:space:]]'))=0 then dbms_output. put_line('First try: Data1 is null'); else dbms_output.
Only one LONG column is allowed per table.
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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With