Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: oracle query vs. $sql->fetch()

Re: oracle query vs. $sql->fetch()

From: stephen O'D <stephen.odonnell_at_gmail.com>
Date: 4 Jan 2006 11:32:02 -0800
Message-ID: <1136403122.479630.210410@g44g2000cwa.googlegroups.com>

Turkbear wrote:

> "blackdog" <cljlk_at_hotmail.com> wrote:
>
> >I use sql> select column1, column2 from a_table;
> >I got three output.
> >
> >But,
> >
> >if I use perl script as below:
> >
> >..........
> >$sql = qq{ select column1, column2 from a_table };
> >.............
> >-------------
> >while( $sql->fetch() ) {
> > print "$column1, column2\n";
> > }
> >
> >I got only two out put, lost the first line of output.
> >
> >please help.
>
> For those who do not know perl, what does
>
> while( $sql->fetch() ) indicate..
>
> Is it just a test for EOF ?

Its *KIND* of like a cursor for loop in PLSQL, it will make a pass over the loop for each row returned from the query. There is some code missing there though that binds perl variables to the actual columns, or puts the row into an array. Received on Wed Jan 04 2006 - 13:32:02 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US