Re: SQL error: function round(double precision, integer) does not exist

From: Din Adrian <adrian(dot)din(at)easynet(dot)ro>
To: tjo(at)acm(dot)org
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: SQL error: function round(double precision, integer) does not exist
Date: 2005-02-28 10:43:11
Message-ID: opsmwld9knawcxfg@adi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-sql

the round sintax is
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(at)acm(dot)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:
> 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(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly

Using Opera's revolutionary e-mail client:

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Sean Davis 2005-02-28 11:24:51 Re: Junk queries with variables?
Previous Message Richard Huxton 2005-02-28 09:34:19 Re: Postgres 8 - problem: invalid input syntax for integer