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

2006-04-25 Thread A. Kretschmer
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

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

2006-04-25 Thread SunWuKung
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 regards, Balázs ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an

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

2006-04-24 Thread Jaime Casanova
On 24 Apr 2006 12:49:51 -0700, SunWuKung <[EMAIL PROTECTED]> wrote: > I was trying to actually do a cast and trap the error but (beside not > having succeeded in doing so) this is a much nicer way. > > Thanks. > Balázs > > in 8.1 you can use exception blocks BEGIN statements EXCEPTION WHE

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

2006-04-24 Thread SunWuKung
I was trying to actually do a cast and trap the error but (beside not having succeeded in doing so) this is a much nicer way. Thanks. Balázs ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscr

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

2006-04-24 Thread Martijn van Oosterhout
On Mon, Apr 24, 2006 at 05:31:46AM -0700, SunWuKung wrote: > 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 co

[GENERAL] isnumeric - checking if text variable is convertable to numeric

2006-04-24 Thread SunWuKung
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_