Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

check if clob contains string oracle

Tags:

sql

oracle

clob

currently i have query with this code to_char(CLOB_COLUM) like %s but the following wont work for very big clob. Is there another solution to check if this column contains some string. Using oracle 11.2.0.4.0

like image 998
Master Yi Avatar asked May 17 '17 12:05

Master Yi


1 Answers

You can use DBMS_LOB.INSTR( clob_value, pattern [, offset [, occurrence]] ):

SELECT *
FROM   your_table
WHERE  DBMS_LOB.INSTR( clob_column, 'string to match' ) > 0;

or

SELECT *
FROM   your_table
WHERE  clob_column LIKE '%string to match%';
like image 182
MT0 Avatar answered Sep 21 '22 04:09

MT0