Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: help me in cursors.
Srikanth Patibanda wrote:
>
> Hello,
>
> I have some problems regarding the cursors.
>
> actually i want to get more than one row from the database. so i am
> using the cursors to get it. but unfortunately i am not able to get the
> records. Yesterday i have given this email and i got one answer that i
> should use NEXT_RECORD in the loop. Even after using that i am able to
> get the records but its not showing all at a time.
>
> Actually my problem is i want to get the records and to display all on
> the screen at a time. As a normal query operates.
>
> The code i used is GIVEN BELOW
>
> NOTE: I WANT TO DISPLAY ALL THE RECORDS AT A TIME ON THE SCREEN.
>
> DECLARE
> cursor c1 is
> select st_id, sample_date, time, compid, concentration
> from analyzed_samples1
> where st_id = :segments.st_id and
> (sample_date between :segments.firstdate and :segments.lastate);
>
>
>
> BEGIN
>
> open c1;
> loop
>
> fetch c1 into :analyzed_samples3.st_id,
> :analyzed_samples3.sample_date,
> :analyzed_samples3.time,
> :analyzed_samples3.compid,
> :analyzed_samples3.concentration;
> exit when c1%notfound;
> next_record;
> end loop;
>
> close c1;
> END;
>
> I really appreciate if anyone answer my question.
>
> Thanking you
>
> SRIKANTH.PATIBANDA
PL/SQL does not put the results from a cursor on the screen. You have to
do it yourself with the dbms_output utilities. The code above might be
returning rows, but there is no code to find out.
BTW: I would get rid of "next_record;".
-- Thomas Griffin Project Leader QUALITECH Systems, Inc. tgriffin_at_qualitech.comReceived on Mon Feb 10 1997 - 00:00:00 CST