Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Slightly OT: Perl and PL/SQL Cursor Question
I suggest you join the Perl DBI list:
http://lists.perl.org/showlist.cgi?name=dbi-users
Perl::DBI works a little differently, it returns undef when the last row is retrieved.
Here's a snippet:
while ( @array = $sth->fetchrow ) {
print q{'} . join(q{','}, @array) . q{'} . "\n"; }
When $sth->fetchrow returns undef, the loop is complete.
BTW, the above one liner dumps a table to CSV format.
Jared
On Tuesday 02 October 2001 12:30, mohammed bhatti wrote:
> In PL/SQL, if I need to know if I've fetched the last
> row, I can do this:
> IF recCursor%NOTFOUND THEN
> ...
> ...
> END IF;
>
> How would I do this in Perl? Looking at the DBI docs,
> there does not seem to be a similar method. It
> suggests doing a COUNT(*) or possibly use the
> following:
> $hash_ref = $sth->fetchall_hashref('id');
>
> So, any similar functionality to %NOTFOUND in Perl?
>
> tia
>
> mkb
>
> __________________________________________________
> Do You Yahoo!?
> Listen to your Yahoo! Mail messages from any phone.
> http://phone.yahoo.com
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Jared Still INET: jkstill_at_cybcon.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Tue Oct 02 2001 - 23:07:44 CDT
![]() |
![]() |