Re: Problems with cursor in forms 4.5

From: Alex Heney <heneya_at_entcf3.agw.co.bt.uk>
Date: 1997/02/10
Message-ID: <32FF0066.1C1A_at_entcf3.agw.co.bt.uk>#1/1


Srikanth Patibanda wrote:

<SNIP>

> Actually my problem is when an user enters the STATION_ID and
> FIRST_DATE AND LASTDATE. He should be able to retrieve the data related
> to it.
>
> DECLARE
> cursor c1 is
> select st_id, sample_date, time, compid, concentration
> from analyzed_samples1
> where st_id = :station1.st_id and
> (sample_date between :segments.firstdate and :segments.lastate);
>
>
>
> BEGIN
>
> open c1;
> loop
>
> fetch c1 into :analyzed_samples1.st_id,
> :analyzed_samples1.sample_date,
> :analyzed_samples1.time,
> :analyzed_samples1.compid,
> :analyzed_samples1.concentration;
> exit when c1%notfound;
> end loop;
>
> close c1;
> END;
>

You are missing a call to the Next_Record built-in. The cursor retrieves both rows, writes the first one into the current record in the :analysed_samples1 block, then overwrites it with the second row beacuse the 'current' row has not been changed. This means that you will only ever see the LAST occurrence retrieved. The Next_Record call should go immediately before the end loop statement.

.
.
.
.
.
.
.


-- 
The above posting represents the personal opinions of the author and
is not to be taken as official (or unofficial) policy or opinions of 
his employer.

Alex Heney, Living in the Global Village.
Received on Mon Feb 10 1997 - 00:00:00 CET

Original text of this message