ORA-00932: inconsistent datatypes: expected – got CLOB

CLOB data type comparison in where clause in Oracle

Error: while comparing the CLOB data type with the CLOB data type I got the following error

create table json_test ( id number, data clob );

create table json_test2 ( id2 number, data2 clob);

SQL> select * from json_test a, json_test2 b where a.data = b.data2;
select * from json_test a, json_test2 b where a.data = b.data2
                                              *
ERROR at line 1:
ORA-00932: inconsistent datatypes: expected - got CLOB

Solution: We need to convert the CLOB datatype to the character before using the CLOB comparison:

select * from json_test a, json_test2 b where to_char(a.data) = to_char(b.data2);

This entry was posted in Oracle on by .
Unknown's avatar

About SandeepSingh

Hi, I am working in IT industry with having more than 15 year of experience, worked as an Oracle DBA with a Company and handling different databases like Oracle, SQL Server , DB2 etc Worked as a Development and Database Administrator.

Leave a Reply