Up Prev Next
From: Michael Peppler <mpeppler at MBAY dot NET>
Subject: numerics and db-lib
Date: Jan 20 1999 3:22PM
>>>>> "Arthur" == Arthur Goldstein writes:
Arthur> When retreiving numeric data it is returned as a string with
Arthur> many spaces after it when using dblib, but not ctlib. How can
Arthur> one get it to return a proper number?
Arthur> I.e. within table_t column_c is defined as numeric(10).
numeric(10) is too large to be expressed as a signed integer on 32bit
machines, so you're going to run into problems anyway when the number
gets converted to floating point for large values stored in the
DB-Library does not understand the NUMERIC/DECIMAL datatype, so it
converts the number to a char string. You can make sure the number is
converted to an actual perl number by various methods, but mainly by
evaluating the $value in a numeric context. Alternatively a simple
s/\s//g; substitution should work as well.
(Although I agree that the value returned should not include the
trailing spaces - I'll try to fix that for the next release).
Michael Peppler -||- Data Migrations Inc.
email@example.com -||- http://www.mbay.net/~mpeppler
Int. Sybase User Group -||- http://www.isug.com
Sybase on Linux mailing list: firstname.lastname@example.org