TEXT_IO [message #388217] |
Mon, 23 February 2009 22:12  |
blood98
Messages: 15 Registered: January 2009 Location: Thai
|
Junior Member |

|
|
I WANT TO QUERY DATA IN TABLE TO TEXT_FILE
DECLARE
Cursor c1 'select * from my table '
BEGIN
for txt in c1
text_io(outfile,txt.name,',');
END;
but I don't like to write a name of my fild in my table
i have more table to write it
|
|
|
|
Re: TEXT_IO [message #388666 is a reply to message #388217] |
Wed, 25 February 2009 21:40   |
blood98
Messages: 15 Registered: January 2009 Location: Thai
|
Junior Member |

|
|
Can you see this code
declare
out_file TEXT_IO.File_Type;
cursor c1 is <---
select a,b,c,d,e,f,g from data ;
begin
out_file := TEXT_IO.Fopen('C:txt.txt','w');
for r in ci
TEXT_IO.PUT(out_file,r.a||','); <---
TEXT_IO.PUT(out_file,r.b||','); <---
TEXT_IO.PUT(out_file,r.c||','); <---
TEXT_IO.PUT(out_file,r.d||','); <---
TEXT_IO.PUT(out_file,r.e||','); <---
TEXT_IO.PUT(out_file,r.f||','); <---
TEXT_IO.PUT(out_file,r.g); <---
TEXT_IO.NEW_LINE(out_file,1);
end loop;
TEXT_IO.Put_Line('Closing the file...');
TEXT_IO.FCLOSE (out_file);
end;
if i have another tabel in my database
I write this code again and in put my fild to
You have another change to write a new code or fix it to short
or write report.rdf to text file
my text file come for report.rdf
|
|
|
Re: TEXT_IO [message #388672 is a reply to message #388217] |
Wed, 25 February 2009 22:00  |
 |
Kevin Meade
Messages: 2103 Registered: December 1999 Location: Connecticut USA
|
Senior Member |
|
|
If I understand, then you might try using refcursors from a package to select the query you want to execute. Then the cursor will not be in your forms code below, just a call to procedure. You will have to pass enough information to figure out which cursor to open etc.
Alternatively you could try writing some kind of union all view that combined queries together and then construct you where clauses such that only one of the selects in your union all view would actually get executed depending upon how you query the view.
The textio line however, you are pretty much stuck with I think. Thus you need to make all your queries have the same column names. Thus the suggestions above for use of refcursor or manually partitioned view.
good luck, Kevin
|
|
|