Oracle 10g-将查询结果写入文件 [英] Oracle 10g - Write queries results to file
问题描述
我想运行200多个选择查询,并将结果附加到文件中.所有查询都是相同的,唯一的区别在于日期时间变量.我没有创建例程的特权,这就是为什么我必须创建所有查询的原因.我没有创建视图或其他表来存储结果的特权.我无权访问PL/SQL.
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.
推荐答案
1-将查询放入文本文件中,如下所示:
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-将其保存在某处(例如c:\ my_file.sql)
2 - Save it somewhere (let's say c:\my_file.sql)
3-在命令提示符下运行此命令:
3 - Run this at the command prompt:
c:\>sqlplus -s username/password@database.domain.com < tmp.sql > output.txt
4-查看"output.txt"内部
4 - Look inside "output.txt"
这篇关于Oracle 10g-将查询结果写入文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!