agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Din Adrian <adrian.din@easynet.ro>
To: tjo@acm.org
Cc: pgsql-sql@postgresql.org
Subject: Re: SQL error: function round(double precision, integer) does not exist
Date: Mon, 28 Feb 2005 12:43:11 +0200
Message-ID: <opsmwld9knawcxfg@adi> (raw)
In-Reply-To: <4222570F.5080901@acm.org>
References: <4222570F.5080901@acm.org>

the round sintax is
round(numeric,int)
not
round (double,int)

you must cast the value into numeric:
ex: round (cast(doublecolumn as numeric),2) should work ok

Adrian Din,
Om Computer & SoftWare



On Sun, 27 Feb 2005 15:26:07 -0800, TJ O'Donnell <tjo@acm.org> wrote:

> I received the following error when executing a SQL statement:
>
> SQL error:
> ERROR:  function round(double precision, integer) does not exist
>
> In statement:
>
> select id,smiles,smarts,parameter,oe_count_matches(smiles,smarts) as  
> count,
>   round((parameter*oe_count_matches(smiles,smarts)),2) as  
> psa,tpsa(smiles) as ctpsa,tpsa
>   from structure,tpsa
>   where id < 237610
>   and oe_count_matches(smiles,smarts) > 0
>
> order by id;
>
> The functions described at:
> http://www.postgresql.org/docs/7.4/static/functions-math.html
> show that round(numeric,int) should work ok.
> If I use round() without a second argument, it works OK, but
> this gives a loss of precision which I do not want.
>
> Can anyone help me with this?
>
> Thanks,
> TJ
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly
>



-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/



view thread (16+ messages)  latest in thread

Message-ID: <opsmwld9knawcxfg@adi>
Permalink:  ../opsmwld9knawcxfg@adi/
Also on:    postgresql.org/message-id/opsmwld9knawcxfg@adi

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: adrian.din@easynet.ro, tjo@acm.org
  Subject: Re: SQL error: function round(double precision, integer) does not exist
  In-Reply-To: <opsmwld9knawcxfg@adi>

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

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