我有类似的查询
从表中选择*;
我想把结果转换成xlsx格式并安排查询。我有一个问题是如何将oracle查询结果加载到xlsx中?
使用Spool将查询结果导出到csv:
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 * from TABLE;
真正的xlsx文件是MS专有格式的二进制文件。
sqlplus只能返回字符串--文本数据spool只写入sqlplus返回的内容——字符串。