| From: | "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com> |
|---|---|
| To: | "pere roca" <peroc79(at)gmail(dot)com> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: simple limit of decimals |
| Date: | 2009-01-14 13:14:30 |
| Message-ID: | dcc563d10901140514o708a5b02mb834e38defcfe903@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Wed, Jan 14, 2009 at 5:43 AM, pere roca <peroc79(at)gmail(dot)com> wrote:
>
> hi all,
>
> I update a column based on a division over two real values. It causes a huge
> number of decimals that I wanna to limit.
>
> UPDATE point_pol SET taxa_record = ((SELECT ((CASE WHEN numtax>0 THEN
> numtax/numreg ELSE 1 END))) where userid='hello'
>
> taxa_record values are real and with real I cannot limit the decimals.
> I tried to apply a round in the sql sentence but complains that round must
> be applied to a single value each time.
Are you doing accounting with reals? not a good idea due to rounding
issues, far better to use numeric(x,y) which will, incidentally, limit
your number of decimal places for you.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | pere roca | 2009-01-14 13:17:32 | Re: simple limit of decimals |
| Previous Message | A. Kretschmer | 2009-01-14 12:59:48 | Re: simple limit of decimals |