Home » Developer & Programmer » Forms » Database to excel
Database to excel [message #82464] Thu, 29 May 2003 05:05 Go to next message
Raj
Messages: 411
Registered: November 1998
Senior Member
I have a table customer master where in i have customername,customeraddress,customer phone and other columns.I want to retrieve this records in excel from database in alphabetical order.How should i go about it?
Please help as it is very urgent
Re: Database to excel [message #82468 is a reply to message #82464] Thu, 29 May 2003 06:08 Go to previous messageGo to next message
Ajith
Messages: 13
Registered: May 2003
Junior Member
Hi raj,
here is the code. you have to use Text_IO package. you can write this code in any trigger event you want. i had written this in the when-button-pressed event.
----------------
DECLARE
my_file TEXT_IO.file_type; -- Declare the variable as a file type.
cursor c1 is select country_id,country from country_cat;
v_countryid varchar2(30);
v_country varchar2(30);
BEGIN
my_file :=TEXT_IO.Fopen('C:abcd.xls','w'); -- Open the File to write.

For get in c1 loop
v_countryid:=get.country;
v_country:=get.country_id;
TEXT_IO.put_line(my_file,v_countryid||'------'||v_country); --Write the fetched values into xls file
End loop;

TEXT_IO.Fclose(my_file); -- Close the opened file
END;
---------------------
Hope it works. pls let me know if any problem occur.
Re: Database to excel [message #82470 is a reply to message #82468] Thu, 29 May 2003 06:14 Go to previous messageGo to next message
Sun
Messages: 92
Registered: August 2002
Member
In the select statement if u use order by. hope the problem will be solved...
Re: Database to excel [message #82474 is a reply to message #82470] Thu, 29 May 2003 06:36 Go to previous messageGo to next message
Ajith
Messages: 13
Registered: May 2003
Junior Member
Yeah thats right. Sorry I forgot about that condition of alphabetical sort order.
Re: Database to excel [message #82529 is a reply to message #82464] Thu, 05 June 2003 00:53 Go to previous message
shadow
Messages: 15
Registered: April 2003
Junior Member
Hi raj I sent a answer it contains html code when I previewed it I saw wrong things if you want you can contact with me and I will send codes
Previous Topic: pop up
Next Topic: How to call a SQL*Report from Oracle Forms Developer
Goto Forum:
  


Current Time: Mon May 16 17:59:49 CDT 2022