Re: numeric conversions?

From: "Jonathan Ellis" <jellis(at)advocast(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: numeric conversions?
Date: 2000-11-20 15:59:33
Message-ID: 047d01c0530b$0fafd0a0$0d00a8c0@dsl.inconnect.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> is the type casting done automaticly? how? can i have an influence of
> the cast order? is there an easy way to doing the rounding?

bf2=# select 1 / 2 from dual;
?column?
----------
0
(1 row)

bf2=# select 1::float / 2 from dual;
?column?
----------
0.5
(1 row)

bf2=# select (1::float / 2)::int from dual;
?column?
----------
0
(1 row)

Also you have the functions round, floor, and ceil, which do what you would
expect.

-Jonathan

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Bruno Boettcher 2000-11-20 16:21:05 pgpl-problem, what's wrong with my loop?
Previous Message Tom Lane 2000-11-20 15:53:48 Re: Like seems to fail !