I have always used the TO_NUMBER function. If this is successful, the string is a valid number. If it fails, the string is not a valid number (error code is ORA-01722).
If you're using pl/sql you could write a function like this:
FUNCTION isnumber (p_str IN VARCHAR2) RETURN BOOLEAN IS
l_test NUMBER;
BEGIN
l_test := To_Number(p_str);
Return TRUE;
EXCEPTION
WHEN OTHERS THEN
Return FALSE;
END;
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.