列名在查询结果中重复

时间:2022-01-25 00:33:57

I am giving a select statement in SQL*Plus. It is retreiving the data but the column name is displayed every time after certain number of rows. I want the column name to be displayed only once.

我在SQL * Plus中给出了一个select语句。它正在检索数据,但每次在一定数量的行之后都会显示列名。我希望列名只显示一次。

For example:

select emp_name from employee.

currently gets output:

目前获得输出:

emp_name
========
raman
sunil
rajesh
dilip

emp_name
========
rahul
pramod
ankita

I want output like this:

我想要这样的输出:

emp_name
========
pankaj
ruchi
amar
rakesh
dilip
raju
rahul

all under single column heading. How can I do that?

全部在单列标题下。我怎样才能做到这一点?

4 个解决方案

#1


You get this effect because the page size is less than the number of rows returned. The default is 14. If you set it to a value greater than the number of rows, no additional headers will be inserted. You can set the pagesize during a sql*plus session with this command:

您会收到此效果,因为页面大小小于返回的行数。默认值为14.如果将其设置为大于行数的值,则不会插入其他标头。您可以使用以下命令在sql * plus会话期间设置pagesize:

set pagesize n

where n is then number of rows. So to set it to 200:

其中n是行数。所以要设置为200:

set pagesize 200

#2


In addition to what Colin and ik_zelf said:

除了Colin和ik_zelf所说的:

set pages 0

or

set pagesize 0

Sqlplus will suppress all headings, page breaks and titles

Sqlplus将禁止所有标题,分页符和标题

#3


Try outputting the result of your query to a file, e.g.:

尝试将查询结果输出到文件,例如:

SQL>SPOOL /tmp/mydata.dat   
SQL>select emp_name from employees;
SQL>SPOOL OFF

#1


You get this effect because the page size is less than the number of rows returned. The default is 14. If you set it to a value greater than the number of rows, no additional headers will be inserted. You can set the pagesize during a sql*plus session with this command:

您会收到此效果,因为页面大小小于返回的行数。默认值为14.如果将其设置为大于行数的值,则不会插入其他标头。您可以使用以下命令在sql * plus会话期间设置pagesize:

set pagesize n

where n is then number of rows. So to set it to 200:

其中n是行数。所以要设置为200:

set pagesize 200

#2


In addition to what Colin and ik_zelf said:

除了Colin和ik_zelf所说的:

set pages 0

or

set pagesize 0

Sqlplus will suppress all headings, page breaks and titles

Sqlplus将禁止所有标题,分页符和标题

#3


Try outputting the result of your query to a file, e.g.:

尝试将查询结果输出到文件,例如:

SQL>SPOOL /tmp/mydata.dat   
SQL>select emp_name from employees;
SQL>SPOOL OFF

#4