isnumeric - checking if text variable is convertable to numeric

Поиск
Список
Период
Сортировка
От SunWuKung
Тема isnumeric - checking if text variable is convertable to numeric
Дата
Msg-id 1145881906.855705.70740@t31g2000cwb.googlegroups.com
обсуждение исходный текст
Ответы Re: isnumeric - checking if text variable is convertable to numeric  (Martijn van Oosterhout <kleptog@svana.org>)
Список 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 по дате отправления:

Предыдущее
От: "Andrus"
Дата:
Сообщение: How to avoid empty temp schemas
Следующее
От: "Mavinakuli, Prasanna (STSD)"
Дата:
Сообщение: Re: HUGE Stack space is gettiing consumed