Re: Populating Block with Items from a Cursor
From: Marcel Claus <Marcel.Claus_at_Informatik.Uni-Oldenburg.DE>
Date: Thu, 14 May 1998 09:01:21 +0100
Message-ID: <6je4q8$oit_at_news.Informatik.Uni-Oldenburg.DE>
GO_BLOCK('THE_BLCK');
CLEAR_BLOCK(NO_VALIDATE); -- clear the content of the target first_row := TRUE;
OPEN c1;
LOOP
EXIT when c1%notfound;
IF first_row THEN
first_row := FALSE;
ELSE
CREATE_RECORD;
END IF;
FETCH c1 INTO :THE_BLCK.COL1, :THE_BLCK.COL2; END LOOP;
CLOSE c1;
END; Received on Thu May 14 1998 - 10:01:21 CEST
Date: Thu, 14 May 1998 09:01:21 +0100
Message-ID: <6je4q8$oit_at_news.Informatik.Uni-Oldenburg.DE>
Ric Parodi wrote:
> OK, so lets see....
>
> I have a cursor from which I fetch the 'records.' Is there a way in forms
> to populate a block with this data? The number of records are not
> predictable.
>
> Thanks,
> -R!
Use PL/SQL:
DECLARE
cursor c1 is
select col1, col2 from tab1 where ...;
first_row BOOLEAN;
-- first_row is needed to make sure you only create the number -- of rows needed and not one row to much, making the cursor -- stand in an empty row of the target block at the end.BEGIN
GO_BLOCK('THE_BLCK');
CLEAR_BLOCK(NO_VALIDATE); -- clear the content of the target first_row := TRUE;
OPEN c1;
LOOP
EXIT when c1%notfound;
IF first_row THEN
first_row := FALSE;
ELSE
CREATE_RECORD;
END IF;
FETCH c1 INTO :THE_BLCK.COL1, :THE_BLCK.COL2; END LOOP;
CLOSE c1;
END; Received on Thu May 14 1998 - 10:01:21 CEST