I want to understand why my columns are missing their headers.
Consider this table:
SQL> DESC customer;
Name Null? Type
------------ -------- ------------
CUST_ID NOT NULL NUMBER(5)
CUST_NAME VARCHAR2(15)
ACCOUNT_ID VARCHAR2(10)
ACCOUNT_TYPE VARCHAR2(2)
STATE VARCHAR2(2)
When I select *
from the table, the result is missing the column headers.
SQL> SELECT * FROM customer;
90001 B and B A-11101 PR AK
90002 XYZ A-11102 CM NJ
90003 JJ Sons A-11103 CM NJ
90004 Exxon A-11104 PR NY
90005 ABC A-11105 CM NY
90006 Smith Co. A-11106 CM MD
90007 Brown Co. A-11107 CM MD
90008 Cooper Inc. A-11108 PR MD
8 rows selected.
Why?
My goal is to display the tables with the headers. If there are other details I need to add, let me know.
asked Jun 5, 2016 at 19:52
1 Answer 1
Heading may be disabled in your environment. Enable it (it is enabled by default).
SQL> select banner from v$version;
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
PL/SQL Release 12.1.0.2.0 - Production
CORE 12.1.0.2.0 Production
TNS for Linux: Version 12.1.0.2.0 - Production
NLSRTL Version 12.1.0.2.0 - Production
SQL> show heading
heading OFF
SQL> set heading on
SQL> select banner from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
PL/SQL Release 12.1.0.2.0 - Production
CORE 12.1.0.2.0 Production
TNS for Linux: Version 12.1.0.2.0 - Production
NLSRTL Version 12.1.0.2.0 - Production
Or pagesize is set 0:
SQL> show heading pagesize
heading ON
pagesize 14
SQL> set pagesize 0
SQL> select banner from v$version;
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
PL/SQL Release 12.1.0.2.0 - Production
CORE 12.1.0.2.0 Production
TNS for Linux: Version 12.1.0.2.0 - Production
NLSRTL Version 12.1.0.2.0 - Production
SQL> set pagesize 14
SQL> select banner from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
PL/SQL Release 12.1.0.2.0 - Production
CORE 12.1.0.2.0 Production
TNS for Linux: Version 12.1.0.2.0 - Production
NLSRTL Version 12.1.0.2.0 - Production
answered Jun 5, 2016 at 20:00
-
I just used
show heading
and it reports thatheading ON
NonCreature0714– NonCreature07142016年06月05日 20:04:53 +00:00Commented Jun 5, 2016 at 20:04 -
1@NonCreature0714 Try pagesize next.Balazs Papp– Balazs Papp2016年06月05日 20:08:04 +00:00Commented Jun 5, 2016 at 20:08
-
That was it, my pagesize was set to 0NonCreature0714– NonCreature07142016年06月05日 20:25:18 +00:00Commented Jun 5, 2016 at 20:25
lang-sql