How can you tell if a value is not numeric in Oracle?

Kyle Williamson picture Kyle Williamson · Mar 2, 2015 · Viewed 112.6k times · Source

I have the following code that returns an error message if my value is invalid. I would like to give the same error message if the value given is not numeric.

IF(option_id = 0021) THEN 
      IF((value<10000) or (value>7200000) or /* Numeric Check */)THEN
          ip_msg(6214,option_name);  -- Error Message
          return;
      END IF;
END IF;      

In SQL Server, I simply used ISNUMERIC(). I would like to do something similar in Oracle. Such as,

IF((!ISNUMERIC(value)) or (value<10000) or (value>7200000))
    THEN ...

Answer

Rob van Laarhoven picture Rob van Laarhoven · Mar 2, 2015
REGEXP_LIKE(column, '^[[:digit:]]+$')

returns TRUE if column holds only numeric characters