Difference between revisions of "SQL - Check with regex if the string text is only composed of numbers"
Jump to navigation
Jump to search
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
< | <syntaxhighlight lang="sql"> | ||
select | |||
text, | |||
case | |||
when REGEXP_LIKE (trim(text), '^[0-9]*$') then 'Yes' | |||
else 'No' | |||
end "Only numbers ?" | |||
from( | |||
select '19051989' text from dual | |||
union | |||
select '19 mai 1989' text from dual | |||
); | |||
</syntaxhighlight> |
Latest revision as of 10:10, 13 April 2018
select
text,
case
when REGEXP_LIKE (trim(text), '^[0-9]*$') then 'Yes'
else 'No'
end "Only numbers ?"
from(
select '19051989' text from dual
union
select '19 mai 1989' text from dual
);