generate xls file through pl/sql [message #610642] |
Sat, 22 March 2014 06:45 |
tisekofti
Messages: 21 Registered: February 2008
|
Junior Member |
|
|
I have created a store procedure in order to display data results into an excel file.
the file is generated in the specify location but when i try to open the file, it states that the file might be corrupted.
When i click "Yes" and open the excel file i can see all my data correctly there, except from the format of my second column (please refer to the attachment). This is what is actually causing the problem with the error message, because i have tried to generate it with a static character and it worked.
the field's datatype is set to varchar2(17) but when the excel is generated the formatting is not corrected.
So my question is, what else can i do in order to "force" the result to be shown as a string?
Thank you
|
|
|
|
Re: generate xls file through pl/sql [message #610653 is a reply to message #610644] |
Sat, 22 March 2014 08:50 |
tisekofti
Messages: 21 Registered: February 2008
|
Junior Member |
|
|
Sorry ,
Here is the code
--------------
file_handle utl_file.file_type;
BEGIN
file_handle := Utl_File.fopen( 'REPORTS', 'calc.xls', 'w');
Utl_File.fclose(file_handle);
file_handle := Utl_File.fopen( 'REPORTS', 'calc.xls', 'a');
for i in (select distinct T.details,T.ACC_NO
from temp t
)loop
Utl_File.put_line(file_handle,i.details||chr(9)||i.ACC_NO);
end loop;
Utl_File.fclose(file_handle);
------------
|
|
|
|
|
Re: generate xls file through pl/sql [message #610744 is a reply to message #610658] |
Mon, 24 March 2014 01:11 |
tisekofti
Messages: 21 Registered: February 2008
|
Junior Member |
|
|
Is there any other way that i can resolve this issue?
If i use the following line in my code
file_handle := Utl_File.fopen( 'REPORTS', 'calc.csv', 'w');
Data is shown correctly but everything is listed in one column instead of two. Is there any way to present exported data in two columns?
thank you once more for all your help
|
|
|
|
|