Friday, September 25, 2020

Use clob column in the where clause in an Oracle database; ORA-00932: inconsistent datatypes: expected - got CLOB

There are several ways to fix the ORA-00932: inconsistent datatypes: expected - got CLOB exception.

Let's say you have a clobColumn in the clobTable with the CLOB datatype. You can use it in the WHERE clause of a select, update, or delete statement by one of the following ways.

1. Use the dbms_lob.compare method

           SELECT * from clobTable 

           WHERE dbms_lob.compare(clobColumn, to_clob('<the value of the column>')) = 0

2. If the clobColumn value is less than 4000 characters, you can use the to_char function.

          SELECT * from clobTable 

           WHERE to_char(clobColumn) = '<the value of the column>';

3. Use like instead of equal.

         SELECT * from clobTable 

           WHERE clobColumn like '<the value of the column>';

-----------------------------------------------------------------------------------------------------------------
Watch the blessing and loving online channel: SupremeMasterTV live




If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book for free here.



No comments:

Post a Comment