pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jonathan Ellis <jellis@advocast.com>
To: pgsql-sql@postgresql.org
Subject: Re: numeric conversions?
Date: Mon, 20 Nov 2000 08:59:33 -0700
Message-ID: <047d01c0530b$0fafd0a0$0d00a8c0@dsl.inconnect.com> (raw)
References: <20001120165133.D25191@erm1.u-strasbg.fr>

> 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




view thread (2+ messages)

Message-ID: <047d01c0530b$0fafd0a0$0d00a8c0@dsl.inconnect.com>
Permalink:  ../047d01c0530b$0fafd0a0$0d00a8c0@dsl.inconnect.com/
Also on:    postgresql.org/message-id/047d01c0530b$0fafd0a0$0d00a8c0@dsl.inconnect.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: jellis@advocast.com
  Subject: Re: numeric conversions?
  In-Reply-To: <047d01c0530b$0fafd0a0$0d00a8c0@dsl.inconnect.com>
  References: <20001120165133.D25191@erm1.u-strasbg.fr> <047d01c0530b$0fafd0a0$0d00a8c0@dsl.inconnect.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