简体   繁体   English

sql oracle查询数据导出

[英]sql oracle query data export

is it possible to export the data from a query using a script alone? 是否可以仅使用脚本从查询中导出数据? i like to run the query and have the data exported automatically without the manual process of exporting the data into .cvs. 我喜欢运行查询并自动导出数据,而无需手动将数据导出到.cvs。

I've tried SPOOL but it doesn't export the fetched data, just the code itself. 我尝试过SPOOL,但它不导出获取的数据,而仅导出代码本身。

Thanks 谢谢

See below , replace table> with your table name and conditions> with your where conditions 参见下文,用表名和条件替换table>并用where条件替换

set colsep '|'
set echo off
set feedback off
set linesize 1000
set pagesize 0
set sqlprompt ''
set trimspool on
set headsep off

spool output.dat

select '|', <table>.*, '|'
  from <table>
where <conditions>

spool off

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM