Is_Number Function
One of the functions that came in handy for me the Is_number function. This function would consume a string and figure out if its a number or not. If the string is a number, the return value is '1'
if not it will return '0'
FUNCTION is_number (p_string IN VARCHAR2)
RETURN INT
IS
v_new_num NUMBER;
BEGIN
v_new_num := TO_NUMBER (p_string);
RETURN 1;
EXCEPTION
WHEN VALUE_ERROR
THEN
RETURN 0;
END is_number;
if not it will return '0'
FUNCTION is_number (p_string IN VARCHAR2)
RETURN INT
IS
v_new_num NUMBER;
BEGIN
v_new_num := TO_NUMBER (p_string);
RETURN 1;
EXCEPTION
WHEN VALUE_ERROR
THEN
RETURN 0;
END is_number;
Comments
Post a Comment