Hi,
I am new to Delphi /Odac so forgive me.
I have a column in an oracle table that I would like sorted and dumped to a text file. Each row being a new line. Approximately 1000 rows in the table.
What is the best method for doing this?
I would very much appreciate explicit code in your reply please.
I would assume:
define a query in OraQuery component with order by included
assign and rewrite (text) file giving filevariable fv.
fetch first row
while not eof do
begin
Writeln (fv, "fetched row")
fetch
end
close (fv);
To be honest it is the fetch that I am unfamilar with. How is this done?
Also I was wondering of the select and save at text file could be done in two statements.
select a column and create a text file
You should use a code like the following
Code: Select all
AssignFile(fv, 'myfile');
Rewrite(fv);
OraQuery.Open;
while not OraQuery.Eof do begin
WriteLn(fv, OraQuery.FieldByName('MY_FIELD').AsString);
OraQuery.Next;
end;
OraQuery.Close;
CloseFile(fv);