Question

I have an Oracle table, and in this table I have a column of type NCLOB. I would like to perform a SELECT LIKE on it like so:

SELECT
*
FROM
T_WEB_TASK_IT
WHERE DBMS_LOB.substr( T_WEB_TASK_IT.ISSUE_DESCRIPTION , 32000, 1)
LIKE '%Turning on the%'

But it isn't working, I get an error saying:

String buffer too small

But I don't understand how can that be, cause I know for a fact that there aren't that many characters in that column for that particular record!

Was it helpful?

Solution

You can use DBMS_LOB.INSTR function to search for strings in the lob. Like this:

SELECT *
FROM   T_WEB_TASK_IT
WHERE  DBMS_LOB.INSTR( T_WEB_TASK_IT.ISSUE_DESCRIPTION , 'Turning on the') > 0

OTHER TIPS

Apart from DBMS_LOB.INSTR, you could also use Regular Expressions:

SELECT *
FROM T_WEB_TASK_IT
WHERE regexp_like(issue_description, 'Turning on the')
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top