Re: create function atof?

From: Achilleus Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
To: mark <postgresql(at)novacolor(dot)ca>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: create function atof?
Date: 2004-02-20 14:24:53
Message-ID: Pine.LNX.4.44.0402201617130.7099-100000@matrix.gatewaynet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

O kyrios mark egrapse stis Feb 20, 2004 :

> Hello,
>
> Is it possible to create a database function that mimics the C function atof?
> I'm guessing it should look something like this:
>
> create function atof(varchar) returns float
> as '??????'
> language ????
> returns null on null input;

Simply use
# select '<some float>'::text::float4;
or

create function atof(varchar) returns float language sql as 'select
$1::text::float' returns null on null input;

>
> Thanks,
>
> Mark
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>

--
-Achilleus

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2004-02-20 14:54:14 Re: create function atof?
Previous Message mark 2004-02-20 14:04:11 create function atof?