Why need Is Number function?
Is_Number function, can help you to check a Value it's number or char. if a value is a number the result will return True, else return FALSE.
Example:
select * from sttm_customer c
where is_number(c.unique_id_value)='Y';
How to create Function "is_number"?
Query:
CREATE OR REPLACE FUNCTION is_number( p_str IN VARCHAR2 )
RETURN VARCHAR2 DETERMINISTIC PARALLEL_ENABLE
IS
l_num NUMBER;
BEGIN
l_num := to_number( p_str );
RETURN 'Y';
EXCEPTION
WHEN value_error THEN
IS_NUMBER RETURN 'N';
END is_number;
IS
l_num NUMBER;
BEGIN
l_num := to_number( p_str );
RETURN 'Y';
EXCEPTION
WHEN value_error THEN
IS_NUMBER RETURN 'N';
END is_number;
Post a Comment