Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Oracle Sql*Plus print many unneeded heading?

Tags:

oracle

sqlplus

When I run a sql statement which supposed to return exact one row, sqlplus print column names many many times ? why ?

like image 329
idiotgenius Avatar asked Jul 08 '10 12:07

idiotgenius


People also ask

How do I set the page size in SQL Plus?

At the SQL*Plus command line, type: set pagesize 30 - this will change the page size to 30 rows. set pause on - this will cause the output to pause every 30 lines; press the enter key to continue.

What is set heading off in Oracle?

Synopsis. The HEADING setting controls whether column headings print when you SELECT or PRINT data. The default value for this setting is ON, which allows column headings to print.

How do I display output in SQL Plus?

To do this we use a procedure called dbms_output. put_line to place the results in a buffer that SQL*Plus will retrieve and display. SQL*Plus must be told to retrieve data from this buffer in order to display the results. The SQL*Plus command 'set serveroutput on' causes SQL*Plus to retrieve and display the buffer.


2 Answers

Probably because your pagesize is much smaller than the number of lines necessary to display the data, due to wrapping. It repeats the heading on each "page" of output, even if it has not completed displaying a single row.

For the purpose of seeing/copy-pasting an entire output as a whole, try SET PAGESIZE 10000 (or some other large number).

For exploring the output in the console, you'd probably want to set it to your console window's height instead (you guessed it - the real "page size"). This way, you'll see exactly one set of headers, whichever place in the output you're in - which is exactly this statement's purpose.

A closely-related command is SET LINESIZE - output width.

like image 59
Dave Costa Avatar answered Sep 19 '22 21:09

Dave Costa


Because of its configuration. You can set sqlplus behaviour via SET:

http://ss64.com/ora/syntax-sqlplus-set.html

like image 36
glutorange Avatar answered Sep 19 '22 21:09

glutorange