如何使用批处理脚本将数据从 oracle 导出到具有列名的 excel 文件中
how to use batch script to export data from oracle into excel file with column names
这是我的 bat 脚本:
set linesize 4000 pagesize 0 colsep ','
set heading off feedback off verify off trimspool on trimout on
spool &1
select *
from siebel.s_contact;
spool off
exit;
然后我尝试运行下面的命令。我可以生成一个包含数据的 Excel
文件,但缺少列名。
C:\Users\jy70606\Documents\Script>sqlplus -s geneos/password@database @C:\Users\jy
70606\Documents\Script\daily.sql daily.csv
我的问题是,如何使列在我的 Excel
中可用?
您的 Bat 脚本包含以下删除列的命令
set heading off
您需要将其打开
set heading on
参考:https://docs.oracle.com/cd/B19306_01/server.102/b14357/ch12040.htm#i2699001
这是我的 bat 脚本:
set linesize 4000 pagesize 0 colsep ',' set heading off feedback off verify off trimspool on trimout on spool &1 select * from siebel.s_contact; spool off exit;
然后我尝试运行下面的命令。我可以生成一个包含数据的
Excel
文件,但缺少列名。C:\Users\jy70606\Documents\Script>sqlplus -s geneos/password@database @C:\Users\jy 70606\Documents\Script\daily.sql daily.csv
我的问题是,如何使列在我的
Excel
中可用?
您的 Bat 脚本包含以下删除列的命令
set heading off
您需要将其打开
set heading on
参考:https://docs.oracle.com/cd/B19306_01/server.102/b14357/ch12040.htm#i2699001