oracle is used to determine whether the number is

2010-12-02  来源:本站原创  分类:Database  人气:53 

CREATE OR REPLACE FUNCTION ISNUMBER (VALID_STR IN VARCHAR2)
RETURN NUMBER
IS
CURSOR VALID_NUMBER IS
SELECT 1 FROM DUAL WHERE regexp_like (VALID_STR ,'^[+-]? \ d + (\. \ D)? \ D *$');
ISNUMBER_ VALID_NUMBER% ROWTYPE;
BEGIN
OPEN VALID_NUMBER;
FETCH VALID_NUMBER INTO ISNUMBER_;
IF (VALID_NUMBER% FOUND) THEN
CLOSE VALID_NUMBER;
RETURN 1;
ELSE
CLOSE VALID_NUMBER;
RETURN 0;
END IF;
END ISNUMBER;

相关文章