Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Column name repeating in query results

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?


2 Answers

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
like image 139
Colin Pickard Avatar answered Nov 25 '25 09:11

Colin Pickard


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

like image 27
beggs Avatar answered Nov 25 '25 09:11

beggs