Subject | Re: [firebird-support] Save decimal data type |
---|---|
Author | Ann Harrison |
Post date | 2013-05-28T20:36:14Z |
On Tue, May 28, 2013 at 10:26 AM, franchessko <scheffer74@...> wrote:
what you see, but I can tell you what Firebird is doing. When you store
25.80 in a column that's defined as decimal 18,4, Firebird stores the
value as in integer, which in this case would be 258000 (two hundred fifty
eight thousand). The scale is part of the field definition. Firebird uses
the scale when doing comparisons, so 258000 scale 4 is more than 2570000
scale 5 and less than 260 scale 1. All that is fine, internally.
However, the SQL numeric and decimal types are based on data types used in
COBOL. Those data types are not generally supported in more modern
languages. When you retrieve a decimal or numeric value with a non-zero
scale, you should probably ask for it as a floating point number or a
string. You'll get better information from the Firebird .NET driver list
on exactly how to push decimal and numeric values through that interface.
integral and decimal portions of a number, so it's reading 25,80 as two
values 25 and 80.
Good luck,
Ann
[Non-text portions of this message have been removed]
> Hi, I'm a new firebird user. I joined here to ask for help.Without seeing the actual queries you used, I'm guessing about why you see
> I develop in DotNet Technologies, and I have this problem:
>
>
> And the problem is:
> -------------------
> When I send a Query with a decimal data type like '25.80' -without quotes-
> the data is saved in firebird like this 2580,0000
> (the database field was created as Decimal 18,4)
>
what you see, but I can tell you what Firebird is doing. When you store
25.80 in a column that's defined as decimal 18,4, Firebird stores the
value as in integer, which in this case would be 258000 (two hundred fifty
eight thousand). The scale is part of the field definition. Firebird uses
the scale when doing comparisons, so 258000 scale 4 is more than 2570000
scale 5 and less than 260 scale 1. All that is fine, internally.
However, the SQL numeric and decimal types are based on data types used in
COBOL. Those data types are not generally supported in more modern
languages. When you retrieve a decimal or numeric value with a non-zero
scale, you should probably ask for it as a floating point number or a
string. You'll get better information from the Firebird .NET driver list
on exactly how to push decimal and numeric values through that interface.
> I tried sending the same number, but with the comma '25,80' but firebirdFirebird does not use the locale to choose the separator between the
> says: "Dynamic SQL Error. SQL Error code = -804. Count of read-write
> columns does not equal count of values"
>
integral and decimal portions of a number, so it's reading 25,80 as two
values 25 and 80.
Good luck,
Ann
[Non-text portions of this message have been removed]