Re: Populating Block with Items from a Cursor
Date: 13 May 1998 21:28:53 GMT
Message-ID: <6jd3al$ad73_at_hendrix.csufresno.edu>
In article <6jb0f5$k8i_at_gap.cco.caltech.edu>,
Ric Parodi <ricardo.parodi_at_caltech.edu> wrote:
> 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.
Make sure your block is a control block (has no base-table assigned to it). Write your pl/sql as follows:
Go_Block('B1');
Set_Block_Property('B1',Insert_Allowed,Property_True);
Clear_Block; -- do this if necessary
Open Cursor1;
Loop
Fetch Cursor1 into :B1.Col1,:B1.Col2,:B1.Col3,...;
Exit when Cursor1%notfound;
Next_Record;
End Loop;
Close Cursor1;
First_Record;
Set_Block_Property('B1',Insert_Allowed,Property_False);
The above creates a display-only block with all your data in it. If the cursor will potentially select more than a few hundred rows, then you shouldn't use the above method. Instead, you should create your On-select, On-Fetch triggers, and a package that these call, which opens the cursor, and fetches rows. This method takes more programming, obviously, but it can be done. (My QA utility form uses the transactional trigger method, and works pretty well).
Regards,
Steve Cosner
http://members.aol.com/stevec5088
Downloadable Quick Access utility form: Display and update any table. Received on Wed May 13 1998 - 23:28:53 CEST