Re: How to create a .csv file to be downloaded through the web

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Fri, 24 Mar 2000 07:39:15 -0500
Message-ID: <6aomdsohi65btsn4rnogt6akopuidt7tih_at_4ax.com>


A copy of this was sent to Ven <vkumar_at_servicelane.com> (if that email address didn't require changing) On Thu, 23 Mar 2000 22:36:58 -0600, you wrote:

>Hi guys,
> We have a corporate intranet with 3 tiers ( web browser , OAS, Oracle Database
>Server). We are using OAS PL/Sql Cartridge to generate the HTML. Now we want
>tocreate some reports. I can create some HTML based reports .I also need to
>create reports that will enable the user to download the file in a comma
>delimited format from the web site, that he/she can suck into Excel for
>analysis. How do I do this, since the OAS server and the database server are on
>different machines ?
>
>Any ideas/Suggestions ?
>
>Thanks
>Venkatesh

add a mime-type to the web listener, call it something like:

application/x-ms-excel csv

or something.

Now, create a package like:

create or replace package my_data
as

   procedure csv( ..... );
end;
/

create or replace package body my_data
as

procedure csv( .... )
is
begin

   owa_util.mime_header( 'application/x-ms-excel' );    for x in ( select a, b from T )
   loop

      htp.p( a || chr(9) || b );
   end loop;
end;

end;
/

Now a URL like http://youhost/dadname/plsql/my_data.csv

will run your package -- you configure the helper app for application/x-ms-excel in the browser to be excel and it'll read in this tab delimited data for you.

-- 
http://osi.oracle.com/~tkyte/
 
Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA

Opinions are mine and do not necessarily reflect those of Oracle Corporation
Received on Fri Mar 24 2000 - 13:39:15 CET

Original text of this message