The problem is the way you pass in tuple status
array. It needs to be provided as an attribute
hash,e.g.,

$sth->execute_array({ ArrayTupleStatus => \@tuple_status });

Regards,
Dean Arnold

On Thu, 29 Aug 2002 12:07:14 -0500 J & C Parker <[EMAIL PROTECTED]> wrote:

I trying to figure out how to use bind_param_array and execute_array.
The documentation is sketchy. I have tried putting each row in an array
and putting each column in an array. The basic idea is to generate 10000
rows of data and insert them. the error message I am getting is "Can't
coerce array into hash at
/usr/lib/perl5/site_perl/5.8.0/i686-linux/DBI.pm line 1501.". Versions
perl 5.8.0, DBI 1.30 and DBD::Oracle 1.12. the basic code follows.

my $sth = $dbh->prepare( "insert into alltypes (col1, col2, col3, col4,
col5)
                         values ( to_date( ?, 'YYYY-MM-DD HH24:MI:SS' ),
?, ?, ?, ? )" )
   or die "can't prepare SQL statement $DBI::errstr\n";
foreach  my $i (1..$cycle)
   {
   $col1[$i] = rand_datetime(); #date
   $col2[$i] = $pass->randpattern("ssssssssss"); #varchar2(35)
   $col3[$i] = int(rand($max)); #number
   $col4[$i] = int(rand()*1000000); #number(6)
   $col5[$i] = rand()*1000000; #number(8,2)
   }
print "data generated\nbinding\n";
$sth->bind_param_array(1, \@col1 )
   or die "having a problem binding array $DBI::errstr\n";
$sth->bind_param_array(2, \@col2 )
   or die "having a problem binding array $DBI::errstr\n";
$sth->bind_param_array(3, \@col3 )
   or die "having a problem binding array $DBI::errstr\n";
$sth->bind_param_array(4, \@col4 )
   or die "having a problem binding array $DBI::errstr\n";
$sth->bind_param_array(5, \@col5 )
   or die "having a problem binding array $DBI::errstr\n";
print "executing\n";
$sth->execute_array(\@tuple_status);
print "executed\n";
print "$sth->rows\n";
print "@tuple_status\n";




Reply via email to