I need to check if a string contains a number. Any number. Not wether or not the string IS a number, but if it contains one.
Examples:
'test' = no numbers.
'test2' = contains number.
Using a regular expression:
SELECT *
FROM test
WHERE REGEXP_LIKE(testcol, '[[:digit:]]');
Not using regular expressions:
SELECT *
FROM test
WHERE testcol LIKE '%0%'
OR testcol LIKE '%1%'
OR testcol LIKE '%2%'
OR testcol LIKE '%3%'
OR testcol LIKE '%4%'
OR testcol LIKE '%5%'
OR testcol LIKE '%6%'
OR testcol LIKE '%7%'
OR testcol LIKE '%8%'
OR testcol LIKE '%9%'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With