isnumeric - checking if text variable is convertable to numeric - Mailing list pgsql-general

From SunWuKung
Subject isnumeric - checking if text variable is convertable to numeric
Date
Msg-id 1145881906.855705.70740@t31g2000cwb.googlegroups.com
Whole thread Raw
Responses Re: isnumeric - checking if text variable is convertable to numeric
List pgsql-general
I am writing a pgsql function and I would need to create a condition
based on the value of a text variable. I would need to check if
text_var is convertable to numeric type and if yes do the conversion,
if no do something else. I couldn't find out how to do that.

Something like:
IF isnumeric(text_var) Then
 num_var:=Cast (text_var AS numeric);
ELSE
....
END IF;

Thanks for the help.
Balázs


pgsql-general by date:

Previous
From: "Andrus"
Date:
Subject: How to avoid empty temp schemas
Next
From: "Mavinakuli, Prasanna (STSD)"
Date:
Subject: Re: HUGE Stack space is gettiing consumed