is_numeric() or extract_numeric() functions?

From: "Ron St(dot)Pierre" <rstpierre(at)syscor(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: is_numeric() or extract_numeric() functions?
Date: 2003-01-28 22:55:44
Message-ID: QTDZ9.134900$Yo4.6428311@news1.calgary.shaw.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I can't find an is_numeric() or extract_numeric() function in postgres
so I decided I would make my own. However, when I try to create the
following function:

CREATE OR REPLACE FUNCTION getnumber(varchar(1)) RETURNS integer AS '
BEGIN
return ($1 ~ '[0-9]');
END;
' LANGUAGE 'plpgsql';

I get the following error:

parse error at or near "["

Anyone know how to fix this, or if there is an is_numeric() or
extract_numeric() function available?

Thanks

--
Ron St.Pierre
Syscor R&D
tel: 250-361-1681
email: rstpierre(at)syscor(dot)com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2003-01-28 23:08:09 Re: ON DELETE CASCADE PROBLEM
Previous Message John Turner 2003-01-28 22:51:04 convert from datepart('epoch', now()) to Date / time