1

我正在使用 SQLcl 生成 csv 输出。

set sqlformat csv  
set heading off  
select * from hr.employees where rownum < 10;  

"EMPLOYEE_ID","FIRST_NAME","LAST_NAME","EMAIL","PHONE_NUMBER","HIRE_DATE","JOB_ID","SALARY","COMMISSION_PCT","MANAGER_ID","DEPARTMENT_ID"  
100,"Steven","King","SKING","515.123.4567",17-JUN-03,"AD_PRES",24000,,,90  
101,"Neena","Kochhar","NKOCHHAR","515.123.4568",21-SEP-05,"AD_VP",17000,,100,90  
102,"Lex","De Haan","LDEHAAN","515.123.4569",13-JAN-01,"AD_VP",17000,,100,90  
103,"Alexander","Hunold","AHUNOLD","590.423.4567",03-JAN-06,"IT_PROG",9000,,102,60  
104,"Bruce","Ernst","BERNST","590.423.4568",21-MAY-07,"IT_PROG",6000,,103,60  

但我得到了我不想要的标题。我想 set heading off 应该关闭标题(就像在 SQLPlus 中所做的那样)为什么它在 SQLcl 中不起作用。如果我清除了 sql 格式(设置 sqlformat),那么就可以正常工作了。它是 SQLcl 中的错误吗?

4

3 回答 3

2

在 11g 和 12c 数据库中使用当前版本的 sqlcl(截至 2017 年 6 月 30 日)可以正常工作:

alter session set NLS_DATE_FORMAT='DD-MON-YYYY';
set feedback off
set sqlformat csv
spool <spool loc>
SELECT <column list> FROM <table list> WHERE <where clause
ORDER BY <order by clause>;
spool off;
于 2017-07-15T19:14:42.677 回答
2
SET PAGESIZE 0

让您无需分页即可运行。

set heading off

应该可以工作,但被打破了。下一个版本将修复它......就像这样

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

BARRY@orcl☘ >set sqlformat csv
BARRY@orcl☘ >set heading off
BARRY@orcl☘ >select * from demo;

1,"Barry"
2,"Lisa"
3,"Rebecca"
4,"Katie-Ellen"
BARRY@orcl☘ >
于 2016-08-08T18:21:18.667 回答
-1

您不想在结果中看到标题?

在 SQLPLUS 中,您可以使用

set pagesize 0
于 2016-05-28T22:02:54.550 回答