Solved

Oracle SQL - clob compare

Posted on 2014-02-19
2
375 Views
Last Modified: 2014-02-20
Hi

I am executing the following to compare a clog that is within 2 different tables.

select dbms_lob.compare(a.MESSAGE,b.MESSAGE)
  from CMS_MAIL a,CMR_MAIL b
where b.ORDERNO = '4'
   and a.JOBNO = '6';


I need the query to output if the same = 0 if different = 1

Not sure how to do this.

Thanks

Mike
0
Comment
Question by:mikeysmailbox1
2 Comments
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 250 total points
ID: 39871735
Per the docs, it returns 0 if successful so try this:

case when  dbms_lob.compare(a.MESSAGE,b.MESSAGE) = 0 then 0 else 1 end
0
 
LVL 34

Expert Comment

by:johnsone
ID: 39871741
According to the documentation here -> http://docs.oracle.com/cd/E16655_01/appdev.121/e17602/d_lob.htm#ARPLS66648

It should already return 0 if they are the same, non-zero if different and NULL if one (or both) of the LOBs are invalid.

If you must have 1, then I would add a simple case statement that would evaluate to 1 if it is non-zero.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now