[Wellington-pm] numeric types
Richard Hector
richard at walnut.gen.nz
Sun Oct 26 20:38:22 PDT 2008
Hi all,
I'm having a play with a database that involves money.
It seems that the proper thing to do is to use SQL's 'numeric' type,
which from the Postgres docs will preserve whatever numbers I give it
perfectly - it looks like it will be saved in BCD or similar to achieve
that.
However, I'm not sure that's so useful if whenever I transfer between a
Perl program and my DB, I'm converting it to a floating point number.
I'm not even clear that that's what will happen; it seems difficult to
work out how Perl has actually stored a given value; perhaps DBI returns
it as a string, which I can match and stick into a more complex data
structure that preserves the components?
How do I know what's happening, and how do I ensure that I'm getting
what I want?
Thanks,
Richard
More information about the Wellington-pm
mailing list