Validating Numeric and Non-Numeric Values

June 2, 2008

To check if numeric and non-numeric values, the following syntax can be use.

Syntax

CODE:
  1. select DECODE( TRANSLATE(<value here>,'0123456789',' '), NULL, 'Numeric','Character')
  2.  from dual;

Example

CODE:
  1. select DECODE( TRANSLATE('12345Z','0123456789',' '), NULL, 'Numeric','Character')
  2.  from dual;

The example above will return 'Character' because the value has non-numeric characters.