Web Server forum
Back To The Forum Home!Search!Private Messaging System

This is Interesting: Free IT Magazines Now Free shipping to   
Web Server Talk Web Server Talk > Free Databases support forum > Oracle database > Oracle Server Tools > Best way to Extract Data from Oracle into Excel




Pages (2): [1] 2 »   Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Best way to Extract Data from Oracle into Excel  
Hank


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-16-05 07:48 AM

Hello,

I'm looking at ways to generate reports based on data in an Oracle
database. This data will be viewed in Excel.

I've looked at Oracle Reports and Oracle Discoverer as possible tools,
but reports created in either of the 2 applications lose their
formatting upon exporting to Excel.

Another method is to use VBA and ADO to connect to Oracle and extract
the data directly into Excel where the reports can then be formatted.

Does anyone have any ideas/comments regarding the above mentioned
techniques? What other approaches are there?

Thanks in advance,
H





[ Post a follow-up to this message ]



    Re: Best way to Extract Data from Oracle into Excel  
Rauf Sarwar


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-16-05 12:50 PM


Hank wrote:
> Hello,
>
> I'm looking at ways to generate reports based on data in an Oracle
> database. This data will be viewed in Excel.
>
> I've looked at Oracle Reports and Oracle Discoverer as possible
tools,
> but reports created in either of the 2 applications lose their
> formatting upon exporting to Excel.
>
> Another method is to use VBA and ADO to connect to Oracle and extract
> the data directly into Excel where the reports can then be formatted.
>
> Does anyone have any ideas/comments regarding the above mentioned
> techniques? What other approaches are there?
>
> Thanks in advance,
> H

A lot can be said about MS but their office tools are excellent
neighbors among themselves i.e. Access, Excel, Word etc. So going from
Access/Excel to Oracle over ADO/OLEDB will be a good option. Then you
have a choice to present data in any of the tools without loosing any
formating.

Crystal reports also has a pretty good engine and works seamlessly with
Oracle.

Regards
/Rauf






[ Post a follow-up to this message ]



    Re: Best way to Extract Data from Oracle into Excel  
Xavi (ZixxeR)


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-16-05 12:50 PM

On 15 Feb 2005 21:42:32 -0800, hank755_ca@yahoo.ca (Hank) wrote:
>I'm looking at ways to generate reports based on data in an Oracle
>database. This data will be viewed in Excel.

I use Oracle Objects for OLE.
http://www.oracle.com/technology/so.../ole/index.html

You have an example here:
http://builder.com.com/5100-6388-5219076.html


Xavi
--
Dain bramaged





[ Post a follow-up to this message ]



    Re: Best way to Extract Data from Oracle into Excel  
Matthias Huebner


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-16-05 10:51 PM

Salut,

Is there realy a BEST WAY?

"Hank" <hank755_ca@yahoo.ca> schrieb im Newsbeitrag
news:58619410.0502152142.48630166@posting.google.com...
> Hello,
>
> I'm looking at ways to generate reports based on data in an Oracle
> database. This data will be viewed in Excel.

Try alternative OpenOffice you may use in Unix/Linux/Solaris Environment
too!

>
> I've looked at Oracle Reports and Oracle Discoverer as possible tools,
> but reports created in either of the 2 applications lose their
> formatting upon exporting to Excel.

with OpenOffice you may export directly to xls-books (Save As) without the
loss of any formatting.
also all edited formula will be translated to excel formulas.

>
> Another method is to use VBA and ADO to connect to Oracle and extract
> the data directly into Excel where the reports can then be formatted.

OpenOffice has a nice DataExplorer which is much more comfortable.

>
> Does anyone have any ideas/comments regarding the above mentioned
> techniques? What other approaches are there?
>

have a look at www.openoffice.org

> Thanks in advance,
> H
Cordialement
Matthias







[ Post a follow-up to this message ]



    Re: Best way to Extract Data from Oracle into Excel  
IANAL_VISTA


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-16-05 10:51 PM

hank755_ca@yahoo.ca (Hank) wrote in
news:58619410.0502152142.48630166@posting.google.com:

> Hello,
>
> I'm looking at ways to generate reports based on data in an Oracle
> database. This data will be viewed in Excel.
>
> I've looked at Oracle Reports and Oracle Discoverer as possible tools,
> but reports created in either of the 2 applications lose their
> formatting upon exporting to Excel.
>
> Another method is to use VBA and ADO to connect to Oracle and extract
> the data directly into Excel where the reports can then be formatted.
>
> Does anyone have any ideas/comments regarding the above mentioned
> techniques? What other approaches are there?
>
> Thanks in advance,
> H

PERL can interoperate with Oracle (& many other DBs) & Excel.





[ Post a follow-up to this message ]



    Re: Best way to Extract Data from Oracle into Excel  
George Lewycky


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-16-05 10:51 PM

Oracle has a program called Discover which is an ad-hoc/customizable
report tool which also has a EXCEL feature to xfer the output into a
excel spreadsheet

TOAD also has this extract feature

Good Luck

George






[ Post a follow-up to this message ]



    Re: Best way to Extract Data from Oracle into Excel  
joel-garry@home.com


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-17-05 01:47 AM

Never used it, but always thought it looked interesting:
http://www.oraxcel.com/projects/sqlxl/

jg
--
@home.com is bogus.
Just went through big stupid project to make online thingee agree with
stupid excel.






[ Post a follow-up to this message ]



    Re: Best way to Extract Data from Oracle into Excel  
Ingo Peters


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-17-05 07:47 AM

On 2005-02-16, Hank <hank755_ca@yahoo.ca> wrote:
> I'm looking at ways to generate reports based on data in an Oracle
> database. This data will be viewed in Excel.
>
> I've looked at Oracle Reports and Oracle Discoverer as possible tools,
> but reports created in either of the 2 applications lose their
> formatting upon exporting to Excel.

Oracle Reports can produce formatted Excel reports via the web.
Actually, it produces HTML code that gets read and interpreted by Excel.

Regards,

Ingo





[ Post a follow-up to this message ]



    Re: Best way to Extract Data from Oracle into Excel  
MBPP


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-17-05 12:47 PM

I have written a procedure in PL/SQL for Oracle Forms which takes
a block and export its columns into an external Excel file. In fact,
this file is an HTML with special tags recognized by the MS Office
tools. With these tags you can virutally create a sheet with any
functionality, event charts. An easy way to find which tag to use is
to create you customized Excel file and save it is as "Web Page".
Then you can edit the saved file in any text editor to view the
generated tags. The below procedure can be adapted to run on the
server too.

procedure cp_mwt_export_to_excel is

type t_format_mask is table of varchar2(30) index by binary_integer;
type t_item_type   is table of varchar2(15) index by binary_integer;
type t_data_type   is table of varchar2(15) index by binary_integer;
type t_multi_line  is table of varchar2(5)  index by binary_integer;
type t_display     is table of boolean      index by binary_integer;
type t_item_id     is table of item         index by binary_integer;

v_format_mask t_format_mask;
v_item_type   t_item_type;
v_data_type   t_data_type;
v_multi_line  t_multi_line;
v_display     t_display;
v_item_id     t_item_id;

v_char   varchar2(4000);
v_number number;
v_date   date;

v_list_value     varchar2(100);
v_prompt_text    varchar2(60);
v_hint_text      varchar2(60);
v_label          varchar2(60);
v_user_url       varchar2(50);
v_user_directory varchar2(50);
v_name           varchar2(30);
v_filename       varchar2(16);
v_status         varchar2(15);
v_visible        varchar2(5);
v_export_item    varchar2(1);
v_rows           pls_integer;
v_columns        pls_integer;
v_lines          pls_integer;
v_index          pls_integer;
v_list_count     pls_integer;
v_list_index     pls_integer;
v_length         pls_integer;
v_type           pls_integer;
v_null           boolean;
v_block_id       block;

v_connection exec_sql.conntype;
v_cursor     exec_sql.curstype;

v_handle text_io.file_type;

begin

enter;

if form_failure = true then
raise form_trigger_failure;
end if;

v_status := get_block_property('DATA',status);

if v_status = 'NEW' then
cp_mwt_display_error('There is no data to be exported.');
raise form_trigger_failure;
end if;

if v_status <> 'QUERY' then
cp_mwt_display_error('Save changes before exporting.');
raise form_trigger_failure;
end if;

cp_mwt_question('Export','Are you sure you want to export to Excel
(maximum of 65,535 records) ?');

v_filename := cf_mwt_generate_filename;

tool_env. getvar('USER_DIRECTORY',v_user_directory
);

v_handle :=
text_io. fopen(lower(v_user_directory||'\'||v_fil
ename)||'.xls','W');

text_io.put_line(v_handle,'<html
xmlns:o="urn:schemas-microsoft-com:office:office"');

text_io.put_line(v_handle,'xmlns:x="urn:schemas-microsoft-com:office:excel"'
);

text_io.put_line(v_handle,'xmlns="http://www.w3.org/TR/REC-html40">');
text_io.put_line(v_handle,'<body>');
text_io.put_line(v_handle,'<table border=1>');
text_io.put_line(v_handle,'<tr>');

v_connection := exec_sql.default_connection;

v_cursor := exec_sql.open_cursor(v_connection);


exec_sql. parse(v_connection,v_cursor,replace(get_
block_property('DATA',last_
query),'ROWID,'));

v_block_id := find_block('EXPORT');

v_columns := 0;

loop
v_columns := v_columns + 1;
begin

exec_sql. describe_column(v_connection,v_cursor,v_
columns,v_name,v_length,v_t
ype);
exception
when exec_sql.invalid_column_number then
v_columns := v_columns - 1;
exit;
end;
v_item_id(v_columns) := find_item('DATA.'||v_name||'_DISPLAY');
if id_null(v_item_id(v_columns)) = true then
v_item_id(v_columns) := find_item('DATA.'||v_name||'_EDIT');
end if;
if id_null(v_item_id(v_columns)) = true then
v_item_id(v_columns) := find_item('DATA.'||v_name);
end if;
if id_null(v_block_id) = false then
v_export_item := name_in('EXPORT.'||v_name);
else
v_export_item := 'Y';
end if;
v_item_type(v_columns) :=
 get_item_property(v_item_id(v_columns),i
tem_type);
v_data_type(v_columns) :=
 get_item_property(v_item_id(v_columns),d
atatype);
v_visible     :=  get_item_property(v_item_id(v_columns),v
isible);
v_prompt_text :=
 get_item_property(v_item_id(v_columns),p
rompt_text);
v_hint_text   :=
 get_item_property(v_item_id(v_columns),h
int_text);
if v_item_type(v_columns) = 'TEXT ITEM' then
v_format_mask(v_columns) :=
 get_item_property(v_item_id(v_columns),f
ormat_mask);
else
v_format_mask(v_columns) := null;
end if;
if v_hint_text is not null then
v_label := v_hint_text;
else
v_label := v_prompt_text;
end if;
if v_item_type(v_columns) <> 'DISPLAY ITEM' and v_visible =
'TRUE' and v_export_item = 'Y' then
v_display(v_columns) := true;
else
v_display(v_columns) := false;
end if;
if v_display(v_columns) = true then
text_io.put_line(v_handle,'<td bgcolor="#FFFF00"
x:autofilter="all"><b>'||v_label||'</b></td>');
end if;
if v_data_type(v_columns) = 'CHAR' then
if v_item_type(v_columns) = 'TEXT ITEM' then
v_multi_line(v_columns) :=
 get_item_property(v_item_id(v_columns),m
ulti_line);
else
v_multi_line(v_columns) := 'FALSE';
end if;

exec_sql. define_column(v_connection,v_cursor,v_co
lumns,v_char,v_length);

end if;
if v_data_type(v_columns) = 'NUMBER' then
if v_format_mask(v_columns) is not null then
v_format_mask(v_columns) :=
 replace(v_format_mask(v_columns),'9','#'
);
v_format_mask(v_columns) :=
 replace(v_format_mask(v_columns),'G',','
);
v_format_mask(v_columns) :=
replace(v_format_mask(v_columns),'D','.');
end if;
v_multi_line(v_columns) := 'FALSE';

exec_sql. define_column(v_connection,v_cursor,v_co
lumns,v_number);

end if;
if v_data_type(v_columns) in ('DATE','DATETIME') then
v_multi_line(v_columns) := 'FALSE';

exec_sql. define_column(v_connection,v_cursor,v_co
lumns,v_date);
end if;
end loop;

text_io.put_line(v_handle,'</tr>');

v_rows := exec_sql.execute(v_connection,v_cursor);

v_lines := 0;

while exec_sql.fetch_rows(v_connection,v_cursor) > 0 loop
v_lines := v_lines + 1;
text_io.put_line(v_handle,'<tr>');
for v_index in 1..v_columns loop
v_null := false;
if v_data_type(v_index) = 'CHAR' then

exec_sql. column_value(v_connection,v_cursor,v_ind
ex,v_char);
if v_char is null then
v_null := true;
end if;
end if;
if v_data_type(v_index) = 'NUMBER' then

exec_sql. column_value(v_connection,v_cursor,v_ind
ex,v_number);
if v_number is null then
v_null := true;
end if;
end if;
if v_data_type(v_index) in ('DATE','DATETIME') then

exec_sql. column_value(v_connection,v_cursor,v_ind
ex,v_date);
if v_date is null then
v_null := true;
end if;
end if;
if v_display(v_index) = true then
if v_null = true then
text_io.put_line(v_handle,'<td></td>');
else
if v_data_type(v_index) = 'CHAR' then
v_char := replace(v_char,' ',' ');
if v_item_type(v_index) = 'CHECKBOX' then
if v_char in ('Y','YES') then
v_char := 'YES';
else
v_char := 'NO';
end if;
end if;
if v_item_type(v_index) = 'LIST' then
v_list_count :=
 get_list_element_count(v_item_id(v_index
));
for v_list_index in 1..v_list_count loop
v_list_value :=
 get_list_element_value(v_item_id(v_index
),v_list_index);
if v_list_value = v_char then
v_char :=
 get_list_element_label(v_item_id(v_index
),v_list_index);
exit;
end if;
end loop;
end if;
if v_multi_line(v_index) = 'TRUE' then
text_io.put_line(v_handle,'<td
style=''white-space:wrap'' x:str>'||v_char||'</td>');
else
text_io.put_line(v_handle,'<td
style=''white-space:nowrap'' x:str>'||v_char||'</td>');
end if;
end if;
if v_data_type(v_index) = 'NUMBER' then
if v_format_mask(v_index) is not null then
text_io.put_line(v_handle,'<td
style=''mso-number-format:"'||v_format_mask(v_index)||'"''
x:num>'||to_char(v_number)||'</td>');
else
text_io.put_line(v_handle,'<td
x:num>'||to_char(v_number)||'</td>');
end if;
end if;
if v_data_type(v_index) = 'DATE' then
text_io.put_line(v_handle,'<td align=left
style=''mso-number-format:"dd-mmm-yyyy"''
x:num>'||to_char(v_date,'DD-MON-YYYY')||'</td>');
end if;
if v_data_type(v_index) = 'DATETIME' then
text_io.put_line(v_handle,'<td align=left
style=''mso-number-format:"dd-mmm-yyyy hh:mm:ss"''
x:num>'||to_char(v_date,'DD-MON-YYYY HH24:MI:SS')||'</td>');
end if;
end if;
end if;
end loop;
text_io.put_line(v_handle,'</tr>');
exit when v_lines = 65535;
end loop;

exec_sql.close_cursor(v_cursor);

exec_sql.close_connection(v_connection);

text_io.put_line(v_handle,'</table>');
text_io.put_line(v_handle,'</body>');
text_io.put_line(v_handle,'</html>');

text_io.fclose(v_handle);

if v_lines > 500 then
host('pkzip -add -silent
 '||lower(v_user_directory||'\'||v_filena
me)||'.zip
 '||lower(v_user_directory||'\'||v_filena
me)||'.xls');
host('del  '||lower(v_user_directory||'\'||v_filena
me)||'.xls');
end if;

 cp_mwt_display_message(to_char(v_lines)|
|' records were successfully
exported - the file will now be downloaded.');

tool_env.getvar('USER_URL',v_user_url);

if v_lines > 500 then

web. show_document(v_user_url||lower(v_filena
me)||'.zip','_blank');
else

web. show_document(v_user_url||lower(v_filena
me)||'.xls','_blank');
end if;

end;






[ Post a follow-up to this message ]



    Re: Best way to Extract Data from Oracle into Excel  
DA Morgan


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-17-05 10:52 PM

Hank wrote:

> Hello,
>
> I'm looking at ways to generate reports based on data in an Oracle
> database. This data will be viewed in Excel.
>
> I've looked at Oracle Reports and Oracle Discoverer as possible tools,
> but reports created in either of the 2 applications lose their
> formatting upon exporting to Excel.
>
> Another method is to use VBA and ADO to connect to Oracle and extract
> the data directly into Excel where the reports can then be formatted.
>
> Does anyone have any ideas/comments regarding the above mentioned
> techniques? What other approaches are there?
>
> Thanks in advance,
> H

Just a quick caution ... if your organization is subject to
Sarbanes-Oxley doing so could be illegal. Be very very careful.
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace 'x' with 'u' to respond)





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 08:37 PM.      Post New Thread    Post A Reply      
Pages (2): [1] 2 »   Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 

Back To The Top
Home | Usercp | Faq | Register