Re: create function atof? - Mailing list pgsql-sql

From Achilleus Mantzios
Subject Re: create function atof?
Date
Msg-id Pine.LNX.4.44.0402201617130.7099-100000@matrix.gatewaynet.com
Whole thread Raw
In response to create function atof?  (mark <postgresql@novacolor.ca>)
List 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@postgresql.org)
> 

-- 
-Achilleus



pgsql-sql by date:

Previous
From: mark
Date:
Subject: create function atof?
Next
From: Tom Lane
Date:
Subject: Re: create function atof?