Subject | RE: [firebird-support] Arithmetics problem (Firebird 1.0.3 WI-V6.2.972) |
---|---|
Author | Kevin Stanton |
Post date | 2004-06-06T23:03:53Z |
IMVHO, I think this was one of the worst things to change - dividing 2
integers now always results in an integer.
There is a fine line between SQL standards and practicality. This has made
me pull hair out (that I can't afford :) and forced more code.
Kevin
-----Original Message-----
From: Markus Ostenried [mailto:chef_007@...]
Sent: Sunday, June 06, 2004 12:57 PM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] Arithmetics problem (Firebird 1.0.3
WI-V6.2.972)
At 19:34 Sunday, 06.06.2004 +0000, semprolbat wrote:
have you tried casting it? Something like
select CAST(1 AS DECIMAL(5,2)) / 100 from rdb$database
AFAIR you have to cast one operand so that Firebird will use the correct
type for the result autmatically.
That's because from your statement Firebird cannot extract data types as
it
can when you do arithmetics with table columns.
HTH,
Markus
Yahoo! Groups Sponsor
ADVERTISEMENT
----------------------------------------------------------------------------
--
Yahoo! Groups Links
a.. To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/
b.. To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[Non-text portions of this message have been removed]
integers now always results in an integer.
There is a fine line between SQL standards and practicality. This has made
me pull hair out (that I can't afford :) and forced more code.
Kevin
-----Original Message-----
From: Markus Ostenried [mailto:chef_007@...]
Sent: Sunday, June 06, 2004 12:57 PM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] Arithmetics problem (Firebird 1.0.3
WI-V6.2.972)
At 19:34 Sunday, 06.06.2004 +0000, semprolbat wrote:
>Why is it thatHi Magnus,
> select (1 / 100) from rdb$database;
>Returns 0 and not 0,01?
have you tried casting it? Something like
select CAST(1 AS DECIMAL(5,2)) / 100 from rdb$database
AFAIR you have to cast one operand so that Firebird will use the correct
type for the result autmatically.
That's because from your statement Firebird cannot extract data types as
it
can when you do arithmetics with table columns.
HTH,
Markus
Yahoo! Groups Sponsor
ADVERTISEMENT
----------------------------------------------------------------------------
--
Yahoo! Groups Links
a.. To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/
b.. To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[Non-text portions of this message have been removed]