Re: [GENERAL] casting float8 type

From: Ulf Mehlig <umehlig(at)uni-bremen(dot)de>
To: bobd(at)palaver(dot)net
Cc: pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] casting float8 type
Date: 1998-11-05 08:05:59
Message-ID: 199811050805.JAA01821@uni-bremen.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Bob Dusek <bobd(at)palaver(dot)net> wrote:

> How would I go about converting a value of type 'float8' to a value
> of type 'int'? It's probably not possible to do a straight
> conversion of a float to an int, but is there a truncate, or a
> rounding function that I could use? I couldn't find such a thing in
> my search.

in a table/class `tbl' with an float attribute `fl' of my 6.3.2 database,
the following works:

select cast(fl as int4) from tbl;

Hope it helps!

Ulf

--
======================================================================
%%%%% Ulf Mehlig <ulf(dot)mehlig(at)uni-bremen(dot)de>
%%%%!%%% Projekt "MADAM" <umehlig(at)uni-bremen(dot)de>
%%%% %!% %%%% ----------------------------------------------------
---| %%% MADAM: MAngrove | Center for Tropical Marine
||--%!% Dynamics | Biology
|| And | Fahrenheitstrasse 1
_ /||\_/\_ Management |
/ / \ \ ~~~~~~~~~~~~~~~~~ | 28359 Bremen/Germany
~~~~~~~~~~~~~~~~~~~~

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Constantin Teodorescu 1998-11-05 08:10:51 Rules aren't saved by pg_dump !!!
Previous Message Bob Dusek 1998-11-05 03:45:25 casting float8 type