I'm sure this is an elementary question, so if there is documentation 
that I've overlooked, please point me in its direction.

I'm trying to convert a DBM-file database to DBI:Pg SQL. I seem to 
have come unstuck in the conversion of numeric arrays. This is my 
take on how things are going wrong:

I have a perl array, @balances, which consists of an array of numbers 
looking like this: (11500 9000 0) if I simply print the array within 
Perl. It should be financial figures, so I've created a row, called 
balances that is NUMERIC(8,2)[].

Now, how do I get the Perl array into the SQL array?

DBI rejects most of my attempts as:

ERROR:  Bad numeric input format '11500 9000 0'

So I've landed up doing something like this:

Convert the array to a comma-delimited list, then finally doing the 
insert of a scalar list as if it was an array:

$dbhandle->do( "INSERT INTO payments (balances) VALUES( 
'{$balances_list}' )" );

Is this the correct way to do this? Surely there must be a better 
(less error-prone) way?

Also, a related question: is it possible to have a NULL value within 
an array? Or are these simply zeroes?
-- 
My brain hurts!
SeanC
                      Mediatek Training Institute
            26 Crart Ave., Berea, Durban, South Africa 
<-- New Address
    phone: +27 (0)31 202 1886              [EMAIL PROTECTED] <-- 
New Phone Number
       fax: +27 (0)31 202 1767 
<-- New Fax Number
                   <http://members.nbci.com/s_carte/>

Reply via email to