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

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: SQL error: function round(double precision, integer) does not exist
Дата
Msg-id 20050228163309.GA105@winnie.fuhr.org
обсуждение исходный текст
Ответ на SQL error: function round(double precision, integer) does not exist  (TJ O'Donnell <tjo@acm.org>)
Ответы Re: SQL error: function round(double precision, integer) does  (TJ O'Donnell <tjo@acm.org>)
Список pgsql-sql
On Sun, Feb 27, 2005 at 03:26:07PM -0800, TJ O'Donnell wrote:

> ERROR:  function round(double precision, integer) does not exist                        ^^^^^^^^^^^^^^^^
[snip]

> The functions described at:
> http://www.postgresql.org/docs/7.4/static/functions-math.html
> show that round(numeric,int) should work ok.                 ^^^^^^^

The two-argument form of round() expects the first argument to be
numeric, not double precision.  There's no implicit cast from double
precision to numeric, so you'll have to use an explicit cast:

SELECT ... round((expression)::numeric, 2) ...

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/


В списке pgsql-sql по дате отправления:

Предыдущее
От: Kai Hessing
Дата:
Сообщение: Re: Software for database-visualisation
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: diference in dates in minutes