Answer the question
In order to leave comments, you need to log in
How to correctly set a pattern in oracle regexp_like() to select rows containing the number 3?
There is an array of strings containing a sequence of numbers separated by spaces.
You must select all rows where the number 3 occurs.
For example:
select '12 4 6' as A from dual union all
select '13 12 61 55' from dual union all
select '31 33 5' from dual union all
select '93 4 0' from dual union all
select '53 3 12 0' from dual union all
select '52' from dual union all
select '3' from dual union all
select '93 3 4 7' from dual union all
select '54 3' from dual union all
You need to select all rows with the number 3 (not a number, i.e. for example, the value 93 is not suitable)
From the above list, the final selection should be:
'93 3 4 7'
'54 3'
while doing it in a clumsy way through like
( a like '3' or a like '3 %' or a like '% 3 %' or a like '% 3'
) whether to do it more elegantly using regex_like().
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question