Querying oracle clob column

后端 未结 4 2058
别那么骄傲
别那么骄傲 2021-02-05 03:10

I have a table with a clob column. Searching based on the clob column content needs to be performed. However

select * from aTable where aClobColumn = \'value\';

4条回答
  •  眼角桃花
    2021-02-05 03:42

    Clob's are large datatypes that can store massive data and hence many operators that support varchar operations will not work on Clob, but in PL/SQL some of them do like mentioned here: http://docs.oracle.com/cd/B19306_01/appdev.102/b14249/adlob_sql_semantics.htm#g1016221

    As you can see in the table Like is supported in both Sql and pl/sql for clobs, but = is not supported in SQL, but is in pl/sql

    If you really need to you could convert to varchar in sql and compare like Tom Kyte mentions here like this: http://sqlfiddle.com/#!4/1878f6/1

    select * from aTable where dbms_lob.substr( aClobColumn , length(aClobColumn), 1 )='value';
    

提交回复
热议问题