I want to run 200+ select queries and append the results to a file. All queries are the same the only difference in the date-time variable. I don't have privileges to create a routine that's why I had to create all the queries. I don't have privileges to create a view or another table to store the results in. I don't have access to PL/SQL.
Now I need to create a report with the results of each one of this queries (all results are integer numbers) but I don't seem to find another solution but to run one by one and copy the results one by one.
Any of you marvelous brains can give me a hand on this? It's kind of urgent.
Hi, You can just right click on the data -> Export -> CSV (select the format that you need) -> location to save -> ok. It exports the table data to File.
1 - Put your queries in a text file like so:
set pagesize 0;
select some_field
from some_table;
select another_field
from another_table;
/
2 - Save it somewhere (let's say c:\my_file.sql)
3 - Run this at the command prompt:
c:\>sqlplus -s username/[email protected] < tmp.sql > output.txt
4 - Look inside "output.txt"
You can spool your output to a file.
See the spool
(URL - Oracle 10.2 user's guide) command.
Also:
http://www.praetoriate.com/t_garmany_easysql_the_spool_command.htm
And what appears to be some layout tips:
http://www.oracle.com/technology/oramag/code/tips2004/020904.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With