I know how I can use utl_file to write data to a flat file.
The problem I have is that I don't know what the select statement is going to look like i.e. number of and type of columns to build an array to store the results set before I loop through the array and write the results out to a flat file.
The hard part I'm finding is buffering the results before writing them back out.
cheers
-----Original Message-----
From: Marty Bertram [mailto:oracledba-ezmlmshield-x65261552.[Email address protected]
Sent: 16 June 2004 17:31
To: LazyDBA Discussion
Subject: RE: Writing out the results from a query back to a file.
Checkout UTL_FILE you can write to an OS flat file with it.
-----Original Message-----
From: Wilkinson Marcus
[mailto:oracledba-ezmlmshield-x60328237.[Email address protected]
Sent: Wednesday, June 16, 2004 4:06 PM
To: LazyDBA Discussion
Subject: Writing out the results from a query back to a file.
Hi,
I'm stuck and need some help.
Here is the scenario.
I have a text file that contains various SQL statements.
I want a Stored Procedure that will
* take the file name as a parameter
* read the file
* identify each SQL statement in the file
* run each statement
* return the results from the statement to a flat file.
So far I have written a SP that will read the file into an array, identify
each SQL statement and rebuild each statement ready for execution.
I'm having problems actually running the SQL statement and writing out the
results to a file. I can't use an array to store the results because I
don't know the number/type of columns until I have built the SQL read in and
rebuilt the SQL statement.
Does anyone have any ideas on this one?
I've started to look at using the dbms_sql package but still trying to get
my head around what it can do and if it will help me.
All your help is gratefully received........ and a welcome headache tablet.
Marcus Wilkinson
--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com
To unsubscribe: see http://www.lazydba.com/unsubscribe.html
To subscribe: send a blank email to oracledba-[Email address protected]
By using this list you agree to these
terms:http://www.lazydba.com/legal.html
--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com
To unsubscribe: see http://www.lazydba.com/unsubscribe.html
To subscribe: send a blank email to oracledba-[Email address protected]
By using this list you agree to these terms:http://www.lazydba.com/legal.html
Oracle LazyDBA home page