SQL stands for structured query language, which is a well-known programming language that is widely used for organizing, manipulating, managing, and extracting stored data in a database. A database is just a table that has rows and columns. Programmers are really proficient with this language to work on the database. They create, update, delete, and edit the database to keep their work continuing. SQL makes life simpler for programmers. When you are working on SQL, you may encounter ‘ora 00932 inconsistent datatypes expected got clob’ error.
Clob stands for character large object, which has the capacity to store data based on Unicode characters. Whereas ORA-00932 is an error that shows up when an inconsistent datatype is used. If two different datatypes are executed you get the inconsistent datatype error. There is no need to get worried as we are here to guide you on how to fix it, but before that, let’s check out how error occurs
How error shows up
When you run the project, you end up with the error warning. Have a look at the code
UPDATE IMS_TEST
SET TEST_Category = 'just testing'
WHERE TEST_SCRIPT = 'something'
AND ID = '10000239'
SQL> create table ims_test(
2 test_category varchar2(30),
3 test_script clob,
4 id varchar2(30)
5 );
Table created.
SQL> insert into ims_test values ('test1','something','10000239');
1 row created.
SQL> UPDATE IMS_TEST
2 SET TEST_Category = 'just testing'
3 WHERE TEST_SCRIPT = 'something'
4 AND ID = '10000239';
WHERE TEST_SCRIPT = 'something'
*
ERROR at line 3:
ORA-00932: inconsistent datatypes: expected - got CLOB
After the code, you end up with this error warning
*** Start Block ***
ORA-00932: inconsistent datatypes: expected - got CLOB
As you have seen how you can land up in the trouble, let’s check out how to fix it
How to Fix the Error ‘ora 00932 inconsistent datatypes expected got clob’
You must have used CLOB in the WHERE clause, which result in the error as you are not allowed to place it where you did. We have a few fixes to handle the exception
Option 1
It is not the right practice to use large or big objects in the condition. If you do that, you end up with the error warning. To compare CLOB data, the best way is the SQL/PL program. of the values you have are no 4k, then you should use the following code
UPDATE IMS_TEST
SET TEST_Category = 'just testing'
WHERE to_char(TEST_SCRIPT) = 'something'
AND ID = '10000239';
Replacing with the code you used in your program can resolve the error message.
Option 2
You also get the error when you are up for ‘SELECT DISTINCT …, <CLOB_column>, …’.
In the case, the clob column has shorter values, you need to limit the VARCHAR2 in all applicable rows. You either may concatenate the end results of various calls to ‘DBMS_LOB.SUBSTR(<CLOB_column>, …)’ or use ‘to_char(<CLOB_column>)’.
Conclusion
We discussed two options to handle the error ‘ora 00932 inconsistent datatypes expected got clob’. You can use either way to fix the issue. I hope it helps!
Reference Source: https://community.microstrategy.com/s/article/KB45918-inconsistent-datatypes-expected-got-CLOB-error-occurs-in?language=en_US
https://stackoverflow.com/questions/12980038/ora-00932-inconsistent-datatypes-expected-got-clob