anyway to determine # rows before fetch loop ends and without seperate count(*)



#Here's an example which shows what I am trying to accomplish. If I
can determine the number of rows before pushing the data, this can
simply things for #me when processing the data throught my scripts.
#
use warnings;
use strict;
use DBI;
use DBD::Oracle;

my $sql=q{ select name, location
from mytable
};

my $dbh;

eval {
$dbh = DBI->connect("dbi:Oracle:MYDB",
'dbuser', 'dbpass',
{
RaiseError => 1,
AutoCommit => 0,
ora_session_mode => 0
}
);
};

if ( $@ ) {
outprint('end',"$DBI::errstr\n");
}

my $sth=$dbh->prepare($sql) or die "Couldn't prepare statement: " . DBI-
>errstr;

$sth->execute or die "Couldn't execute statement: " . DBI->errstr;

my $ary;

while ($ary = $sth->fetchrow_array()) {
#I need to determine number of rows as this will affect
whether a matrix is used or not
#a boolean variable $matrix could be returned or a ref
check done so that the data
#processing code can act accordingly
#$sth->rows only shows total rows after the while loop
is processed
#Can I accomplish this without a seperate count(*)
statement?
#
#push @newary,[ @{$ary} ]; # if more than one row
#or
#push @newary, @{$ary} ; # single row
}

$sth->finish;

$dbh->disconnect;
#
#ActivePerl 5.8.7 813
#ppm
#-DBD-Oracle 1.16
#-DBI 1.48
.



Relevant Pages

  • Activex Export Multiple files
    ... i would like to accomplish this within an sql dts package using an ... activex script. ... Prev by Date: ...
    (microsoft.public.sqlserver.dts)
  • Copying 2 or more txt files into one.
    ... But I can't figure out how to accomplish that in Opal. ... The execute method keeps giving me an ... Jerry ... Prev by Date: ...
    (comp.databases.paradox)
  • Re: Pop Quiz
    ... amount to shit and accomplish nothing. ... Prev by Date: ...
    (rec.radio.shortwave)
  • Re: Top 10 Text Values
    ... I tried setting the AutoFilter and choosing "Top 10", ... > I thought might work, like Frequency and Rank, but those seem to be for ... Is there a way I can accomplish this? ... Prev by Date: ...
    (microsoft.public.excel.worksheet.functions)
  • Remove Rows in a List Box after fields are updated
    ... my time constraints I do not want to write code, ... their is no other way to accomplish this task let me know. ... James E ... Prev by Date: ...
    (microsoft.public.access.forms)