views:

44

answers:

2

I need to create a flat file and push information into it from oracle database using JSP. I require a sample code. Help will be appreciated.

A: 

I think you need to look into Oracle external tables. These are flat files that appear as tables in the Oracle database. You would simply insert data into it using SQL (as per any other database table). Google "Oracle External Tables" for more information.

VinceJS
This depends on database version (external tables were read-only in 9i) and also depends on usage. Writeable external tables are intended for data unloading, rather than, say, logging.
APC
And while external tables are nifty, they tend not to work well for client-side solutions, as the file system of the source data needs to be visible to the Oracle database server. I'm definitely nervous about giving the universe write access to file systems accessible to my database server.
Adam Musch
A: 

If you're looking for an easy way to write different SQL statements to a file, use this procedure: http://www.oracle-developer.net/content/utilities/data_dump.sql

Also you might want to look into DBMS_XSLPROCESSOR.CLOB2FILE.

jonearles