Subject | Re: [firebird-support] check if string is numeric |
---|---|
Author | Ivan Prenosil |
Post date | 2004-03-01T19:14:48Z |
> How can one check if a varchar type field value can be cast toSimply try to cast it and catch possible exceptions. e.g.
> integer with a stored procedure or UDF?
CREATE PROCEDURE IsNumber (x VARCHAR(20))
RETURNS (ret CHAR(1)) AS
DECLARE VARIABLE tmp INTEGER;
BEGIN
ret = NULL;
IF (x IS NULL) THEN EXIT;
tmp = x;
ret = 'Y';
WHEN ANY DO ret = 'N';
END
Ivan
http://www.volny.cz/iprenosil/interbase/