Subject: | SQL_NUMERIC rounds (12450.46 is stored as 12450.50 in the database) |
Given the following table:
===
Column | Type | Modifiers
--------+---------------+-----------
id | numeric(32,0) | not null
num | numeric(8,2) | not null
dez | numeric(8,2) | not null
===
inserting values with:
===
my $sth = $dbh->prepare("
INSERT INTO fh_test VALUES (:pk, :num, :dec)
");
$sth->bind_param(':pk', 1, SQL_NUMERIC);
$sth->bind_param(':num', 12450.46, SQL_NUMERIC);
$sth->bind_param(':dec', 12450.46, SQL_DECIMAL);
$sth->execute;
$sth->finish;
===
results in:
===
id | num | dez
----+----------+----------
1 | 12450.50 | 12450.46
===
I tried this with DBD::Oracle too - no rounding occurs there.
I also found no reference in the DBI and DBD::Pg documentation about
this behavior while using bind types.