How to check the occurrence of a string in a line and get x characters to its left and y to the right?

3

I have a problem with a MySQL query and I'm looking for help. Suppose I have many rows in the PROCESS column and one of them looks like this:

IBAMAPROCUR: DF00025372 ADRIANA MAIA VENTURINIAPDO: JOSE DOS

I want to check if there are 25372 characters in this line, if it exists, I want to get 10 characters before the location and 10 later. And check if in this interval there is the abbreviation DF. If it exists, it shows the line. In this way I would be sure that this is an OAB number for a lawyer. Would someone help me set up a select for this?

    
asked by anonymous 22.05.2015 / 15:11

1 answer

1

Hello.

A common select with where is not good for you?

SELECT Name, Processes FROM (Table) WHERE Processes LIKE '% df%' AND Processes LIKE '% 25372%'

    
22.05.2015 / 19:41