SQL (Structured Query Language) Question:

How to implement ISNUMERIC function in SQL *Plus ?

Tweet Share WhatsApp

Answer:

Method 1:

Select length (translate (trim (column_name),' +-.0123456789',' ')) from dual ;

Will give you a zero if it is a number or greater than zero if not numeric (actually gives the count of non numeric characters)

Method 2:

select instr(translate('wwww',
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'),'X')
FROM dual;

It returns 0 if it is a number, 1 if it is not.

Download SQL PDF Read All 172 SQL Questions
Previous QuestionNext Question
Which Oracle supplied package will enable this feature?What is the difference between Truncate and Delete interms of Referential Integrity?