Home » Developer & Programmer » Forms » Fetch more than one record in cursor (Forms6i)
Fetch more than one record in cursor [message #379411] Tue, 06 January 2009 06:30 Go to next message
adnanBIH
Messages: 41
Registered: November 2007
Location: BiH, Sarajevo
Member
Hello there.
I created procedure for populating Excel sheet, but, I don't know how to fetch more than one column in cursor. This is the code:

PROCEDURE populate_excel IS

application OLE2.OBJ_TYPE;
workbooks OLE2.OBJ_TYPE;
workbook OLE2.OBJ_TYPE;
worksheets OLE2.OBJ_TYPE;
worksheet OLE2.OBJ_TYPE;
cell OLE2.OBJ_TYPE;
args OLE2.LIST_TYPE;
tab1 OLE2.OBJ_TYPE;
tab2 OLE2.OBJ_TYPE;
tab3 OLE2.OBJ_TYPE;

row_num number := 2;
CURSOR C1 IS 
select tabela EngServUnit 
	from adnan_ees;
EngServUnit varchar2(10);

BEGIN
  
BEGIN
application:=OLE2.CREATE_OBJ('Excel.Application');
workbooks:=OLE2.GET_OBJ_PROPERTY(application, 'Workbooks');
workbook:=OLE2.INVOKE_OBJ(workbooks,'Add');
tab1 := get_object_handle(application,workbook,1);
ole2.set_property(tab1, 'Name', 'Analiza tehničari');


FOR ctr IN C1 LOOP
args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, row_num);
OLE2.ADD_ARG(args, 1);
cell:=OLE2.GET_OBJ_PROPERTY(tab1, 'Cells', args);
OLE2.DESTROY_ARGLIST(args);
OLE2.SET_PROPERTY(cell, 'Value', ctr.EngServUnit);
OLE2.RELEASE_OBJ(cell);
row_num := row_num + 1;
END LOOP;

OLE2.SET_PROPERTY(application, 'Visible', True);
OLE2.RELEASE_OBJ(worksheet);
OLE2.RELEASE_OBJ(worksheets);
OLE2.RELEASE_OBJ(workbook);
OLE2.RELEASE_OBJ(workbooks);
OLE2.RELEASE_OBJ(application);

--close excel worksheet/workbook/application
ole2.invoke(worksheet,'Close');
ole2.invoke(workbook,'Close');
ole2.invoke(application,'Quit');

END;
END;


Thx in advance...
Re: Fetch more than one record in cursor [message #379419 is a reply to message #379411] Tue, 06 January 2009 06:55 Go to previous message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
This cursor?
CURSOR C1 IS 
select tabela EngServUnit 
from adnan_ees;

If so, simply add more columns, such as:
cursor c1 is
  select tabela, broj_ees, datum_ees, snaga_ees
  from adnan_ees;
Previous Topic: req solution
Next Topic: How to define a Type Record as Global?
Goto Forum:
  


Current Time: Mon Feb 10 02:06:47 CST 2025