I need to plot a result set from DBI. Before I can do that, I need to know how many
rows are returned, so I can set up my x, y axis right.
I am doing
#######################################################
$csr = $dbh->prepare($sql);
$csr->execute();
#get the number that how many rows returned
my $number_rows = 0;
while (my @rows = $csr->fetchrow_array )
{
$number_rows +=1;
}
Set my x,y axis accordingly............
#begin to plot the data
my ($x_definition,$y_definition);
while (my @row = $csr->fetchrow_array )
{
$counter = 0;
foreach my $data (@row)
Plot the data
}
########################################################
but I got an error
281
DBD::Oracle::st fetchrow_array failed: ERROR no statement executing (perhaps you need
to call execute first) at ./test.pl line 162.
Do I have to make a second db call, or there is better way of doing it?
Thanks
chunning