SQL - Check with regex if the string text is only composed of numbers

From GUILLARD WIKI
Revision as of 16:29, 24 August 2016 by Guillard (talk | contribs) (Created page with "<code>select</code><br/>   <code>text,</code><br/>   <code>case </code><br/>     <code>when REGEXP_LIKE (trim(text), '^[0-9]*$') then '...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

select
  text,
  case
    when REGEXP_LIKE (trim(text), '^[0-9]*$') then 'Yes'
    else 'No'
  end "Test ?"
from(
  select '19051989' text from dual
  union
  select '19 mai 1989' text from dual
);