Solved

Oracle SQL - clob compare

Posted on 2014-02-19
2
382 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 77

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 35

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
PL/SQL More than one element associated with another element 7 55
pl/sql - query very slow 26 88
Excess Redo 3 32
how to tune the query 17 59
This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
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…

733 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