考虑到TEST_SCRIPT是一个CLOB为什么当我在Oracle上从sql * PLUS运行这个简单的查询时,我得到错误:
ORA-00932: inconsistent datatypes: expected - got CLOB
我已经阅读了很多关于同样的错误的问题,但没有一个运行从sqlPLUS直接查询
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@H_403_11@
@H_403_11@
您不能将CLOB放在WHERE子句中。从
documentation:
Large objects (LOBs) are not supported in comparison conditions.
However,you can use PL/sql programs for comparisons on CLOB data.
如果您的值总是小于4k,您可以使用:
UPDATE IMS_TEST SET TEST_Category = 'just testing' WHERE to_char(TEST_SCRIPT) = 'something' AND ID = '10000239';@H_403_11@ 原文链接:https://www.f2er.com/oracle/206968.html