Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: oracle query vs. $sql->fetch()
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
![]() |
![]() |