ORACLE encuentra algunas palabras anteriores y siguientes en un NCLOB

I have large strings in NCLOB column and I'm allowing users to search in them. I'd like to diplay the results in best way possible. Is there any way to 'cut' some previous and next words in my result set?

The results are found by using dbms_lob.instr() function. I've found some solutions, but they are way to complex and slow to use them in this case.

What wold be most effective way? Combination of instr and susbstr? Or regexp? I'm worried about the regexp performance on LOB columns.

preguntado el 31 de julio de 12 a las 10:07

1 Respuestas

Ok, I did it! Like this

REGEXP_SUBSTR(dbms_lob.substr(MC.content_txt,80,dbms_lob.instr(UPPER(MC.content_txt),UPPER(:key))-40),' .+[ \/,\\]',1,1,'n')

It cuts of 80 chars around the key and after that couts out full words (from first space to last space/comma/slash/backshlash).

Respondido 31 Jul 12, 16:07

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.