> -----Original Message-----
> From: Amit Saxena [mailto:[EMAIL PROTECTED]
> Sent: 11 September 2008 12:53
> To: Perl Beginners
> Cc: Amit Saxena
> Subject: Fetching "n" number of records at a time in Perl DBI !
> 
> Hi all,
> 
> I am looking for a "fetch" function to fetch "n" number of records at
a
> time
> in Perl DBI !
> 
> "fetchrow_hashref" fetches one row at a time whereas
"fetchall_hashref"
> fetches all the rows at a time.
> 
> The requirement is to get 100 records at a time (in array or hash)
before
> printing it into the output file.
> 
> I don't want to use following style ;-
> 
> my $count=0;
> while ($href1 = $sth->fetchrow_hashref())
> {
>       my @arr1 = ();
>       $count = $count + 1;
>       %arr1 = %$href1;
>       if ($count == 100)
>       {
>            # print to the output file
>            print PTR %arr1;
>       }
> }
> 
> Thanks & Regards,
> Amit Saxena
[Stewart Anderson] 
Any particular  reason  you don't want to do that,  it seems to  me that
whichever way  you do it you will need to loop  through   the  returned
rows  until they are all done. 

There  are the fetchall functions but I guess there is the risk   of
returning  a gazillion rows  into 1 array there.

Stu 

Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to