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.
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?
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:
set pagesize n
where n is then number of rows. So to set it to 200:
set pagesize 200
In addition to what Colin and ik_zelf said:
set pages 0
or
set pagesize 0
Sqlplus will suppress all headings, page breaks and titles
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
See http://download.oracle.com/docs/cd/B28359_01/server.111/b31189/ch12040.htm#SQPUG095
set pages 50000
Ronald
来源:https://stackoverflow.com/questions/1073291/column-name-repeating-in-query-results