2
I have a 'Text' column in my 'process' table. Text consists of a VARCHAR (220), in this text I need to identify a specific word pattern. In this case a sequence of numbers with a "-" to separate:
'1234-567' - Are 4 digits followed by '-' and then after 3 digits;
And before this number is a word like 'Pronumber: '.
So I tried to use the Substring and Locate function, to track and show the result.
SELECT substring(Texto, locate('ProNumber:', Texto) +11,8) como número FROM processo;
But unfortunately this number appears several times in the 'Text' column field, and my query only shows the first one.
Is there any way to make a query that returns the various numbers that the field contains?
Edited:
I wish the result was something like:
Process | Pronumber
0001 | 1234-567
0001 | 8945-567
0002 | 1258-567
0003 | 1454-547
0004 | 1548-987
0004 | 1234-567
Your question is a little confused. You want to make a filter (
WHERE
) that finds records with this numeric pattern or wants to have an output onSELECT
that removes from the text some characters that are not in this pattern?– Pagotti
I’m sorry, what I’m wanting is for the result of Select to be a column, in show the sequences of numbers, contained in the field. In the middle of the field there may be for example 3 of these sequences, I would like the 3 to be returned by Select.
– fernandoassiss
Hello, please add some example records and the exact output (SELECT result) you need?
– Fernando Mertins