转载:IS NUMBER - Oracle FAQ
Oracle doesn’t have a built-in IS_NUMERIC function to check is a value is numeric, but over the years people developed innovative alternatives. This page will discuss some of them:
# SQL solution
Pure SQL solutions usually use TRANSLATE or REGEXP_LIKE to identify numeric data. Some examples:
1 | SELECT CASE WHEN TRIM(TRANSLATE(col1, '0123456789-,.', ' ')) IS NULL |
# PL/SQL solution
A more elegant method would be to create a PL/SQL function that can be used for checking:
1 | CREATE OR REPLACE FUNCTION is_number (p_string IN VARCHAR2) |
# Comments
Find not null and not numerical value.
1 | SELECT col1 |