Subject | Re: Rounding large numbers |
---|---|
Author | marrtins_dqdp |
Post date | 2008-08-08T14:36:13Z |
--- In firebird-support@yahoogroups.com, "Alan McDonald" <alan@...> wrote:
Damn, I was sure my DB is dialect 3, but it it appears to be still
dialect 1 o_O
I tested on dialect 3 database - works fine.
Thanks!
>Client SQL dialect 1 does not support reference to BIGINT datatype
> > Hello!
> >
> > I have few servers with Firebird versions. On some servers live
> > version 2.0.4 on others 2.1.0
> >
> > I need to round one column with precision 4 digits. It is done via
> > trigger. Column is defined as DOUBLE PRECISION
> >
> > On 2.1.0 I do
> > new.TOTAL = ROUND(new.TOTAL, 4);
> >
> > On 2.0.4 I do
> > new.TOTAL = ROUND(CAST(new.TOTAL * 10000 AS INTEGER)) / 10000;
> >
> > Both worked fine till today new.TOTAL hit 1482835105.6 in one row,
> > which gave me 0.0000 on v2.1.0 and `arithmetic exception, numeric
> > overflow, or string truncation` on v2.0.4
> >
> > Someone may test it
> > v2.1.0
> > SELECT ROUND(1482835105.6, 4)
> > FROM RDB$DATABASE
> >
> > v.2.0.4
> > SELECT ROUND(CAST(1482835105.6 * 10000 AS INTEGER)) / 10000
> > FROM RDB$DATABASE
> >
> > My question is - how to round such large numbers?
> >
> > Thank you!
>
> try casting as BIGINT
> Alan
>
Damn, I was sure my DB is dialect 3, but it it appears to be still
dialect 1 o_O
I tested on dialect 3 database - works fine.
Thanks!