Re: isnumeric - checking if text variable is convertable to numeric

Поиск
Список
Период
Сортировка
Искать
От
A. Kretschmer
Тема
Re: isnumeric - checking if text variable is convertable to numeric
Дата
Msg-id
20060425092336.GE20325@webserv.wug-glas.de
Ответ на
Список
Дерево обсуждения
isnumeric - checking if text variable is convertable to numeric "SunWuKung" <Balazs.Klein@t-online.hu>
Re: isnumeric - checking if text variable is convertable to numeric Martijn van Oosterhout <kleptog@svana.org>
Re: isnumeric - checking if text variable is convertable to numeric "SunWuKung" <Balazs.Klein@t-online.hu>
Re: isnumeric - checking if text variable is convertable to numeric "Jaime Casanova" <systemguards@gmail.com>
Re: isnumeric - checking if text variable is convertable to numeric "SunWuKung" <Balazs.Klein@t-online.hu>
Re: isnumeric - checking if text variable is convertable to numeric "A. Kretschmer" <andreas.kretschmer@schollglas.com>
am  25.04.2006, um  2:01:49 -0700 mailte SunWuKung folgendes:
> I tried this but couldn't find out what would be the WHEN condition for
> 
> Select Cast('asdf' as numeric)
> ERROR:  invalid input syntax for type numeric

create or replace function check_numeric(varchar) returns bool as $$
declare
        i numeric;
begin
        i := $1::numeric;
        return 't'::bool;
        EXCEPTION WHEN invalid_text_representation then
                return 'f'::bool;
end;
$$ language plpgsql immutable strict;



HTH, Andreas
-- 
Andreas Kretschmer    (Kontakt: siehe Header)
Heynitz:  035242/47215,      D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
 ===    Schollglas Unternehmensgruppe    === 
В списке pgsql-general по дате отправления
От: Harald Armin Massa
Дата:
От: surabhi.ahuja
Дата:
FAQ