您也可以使用以下,虽然它在字段之间引入空格。
set colsep,-- separate columns with a comma set pagesize 0 -- No header rows set trimspool on -- remove trailing blanks set headsep off -- this may or may not be useful...depends on your headings. set linesize X -- X should be the sum of the column widths set numw X -- X should be the length you want for numbers (avoid scientific notation on IDs) spool myfile.csv select table_name,tablespace_name from all_tables where owner = 'SYS' and tablespace_name is not null;
输出将如下:
TABLE_PRIVILEGE_MAP,SYstem SYstem_PRIVILEGE_MAP,SYstem STMT_AUDIT_OPTION_MAP,SYstem DUAL,SYstem ...
这将比打印所有字段和使用逗号连接它们少得多。你可以跟进一个简单的sed脚本来删除出现在逗号之前的空格,如果你想的话。
这样的东西可能工作…(我的sed技能是非常生锈,所以这可能需要工作)
sed 's/\s+,/,/' myfile.csv
原文地址:https://www.jb51.cc/oracle/209009.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。