Blog coding and discussion of coding about JavaScript, PHP, CGI, general web building etc.

Monday, December 14, 2015

ORA-00932: inconsistent datatypes: expected - got CLOB

ORA-00932: inconsistent datatypes: expected - got CLOB


Considering that TEST_SCRIPT is a CLOB why when I run this simple query from SQL*PLUS on Oracle, I get the error:

ORA-00932: inconsistent datatypes: expected - got CLOB  

I have been reading a lot of questions about the same error but none of those is running a direct query from SQLPLUS

    UPDATE IMS_TEST          SET TEST_Category  = 'just testing'         WHERE TEST_SCRIPT    = 'something'         AND ID             = '10000239'   

Full example:

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  

Answer by Craig for ORA-00932: inconsistent datatypes: expected - got CLOB


You can't put a CLOB in the WHERE clause. From the documentation:

Large objects (LOBs) are not supported in comparison conditions. However, you can use PL/SQL programs for comparisons on CLOB data.

If your values are always less than 4k, you can use:

UPDATE IMS_TEST      SET TEST_Category           = 'just testing'     WHERE to_char(TEST_SCRIPT)    = 'something'     AND ID                      = '10000239';  

It is strange to search by a CLOB anyways.. could you not just search by the ID column?

Answer by santosh Kundkar for ORA-00932: inconsistent datatypes: expected - got CLOB


There is no solution for this problem. To overcome from this problem try to use id column or another column

Answer by kirby for ORA-00932: inconsistent datatypes: expected - got CLOB


Take a substr of the CLOB and then convert it to a char:

UPDATE IMS_TEST SET TEST_Category = 'just testing' WHERE to_char(substr(TEST_SCRIPT, 1, 9)) = 'something' AND ID = '10000239';

Answer by Franc Drobnič for ORA-00932: inconsistent datatypes: expected - got CLOB


The same error occurs also when doing SELECT DISTINCT ..., , .... If this CLOB column contains values shorter than limit for VARCHAR2 in all the applicable rows you may use to_char() or concatenate results of multiple calls to DBMS_LOB.SUBSTR(, ...).

Answer by user5677770 for ORA-00932: inconsistent datatypes: expected - got CLOB


The problem may lie in selected null values ??in combination with a CLOB-type column.

select valueVarchar c1 , valueClob c2 , valueVarchar c3 , valueVvarchar c4 of Table_1 union select valueVarchar c1 , valueClob c2 , valueVarchar c3 , null c4 of table_2

I reworked the cursor. The first cursor is composed of four non-null columns. The second cursor selects three non-null columns. The null values ??were injected into the cursorForLoop .


Fatal error: Call to a member function getElementsByTagName() on a non-object in D:\XAMPP INSTALLASTION\xampp\htdocs\endunpratama9i\www-stackoverflow-info-proses.php on line 71

0 comments:

Post a Comment

Popular Posts

Powered by Blogger.