pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Achilleus Mantzios <achill@matrix.gatewaynet.com>
To: mark <postgresql@novacolor.ca>
Cc: pgsql-sql@postgresql.org
Subject: Re: create function atof?
Date: Fri, 20 Feb 2004 16:24:53 +0200 (EET)
Message-ID: <Pine.LNX.4.44.0402201617130.7099-100000@matrix.gatewaynet.com> (raw)
In-Reply-To: <200402200904.11199.postgresql@novacolor.ca>

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




view thread (5+ messages)  latest in thread

Message-ID: <Pine.LNX.4.44.0402201617130.7099-100000@matrix.gatewaynet.com>
Permalink:  ../Pine.LNX.4.44.0402201617130.7099-100000@matrix.gatewaynet.com/
Also on:    postgresql.org/message-id/Pine.LNX.4.44.0402201617130.7099-100000@matrix.gatewaynet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: achill@matrix.gatewaynet.com, postgresql@novacolor.ca
  Subject: Re: create function atof?
  In-Reply-To: <Pine.LNX.4.44.0402201617130.7099-100000@matrix.gatewaynet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox