Home » SQL & PL/SQL » SQL & PL/SQL » Table heading
Table heading [message #199797] Thu, 26 October 2006 04:04 Go to next message
arunprabhu29917
Messages: 15
Registered: September 2006
Location: Tamilnadu
Junior Member

please any one tell me

1. how to retrieve table with user defined heading like " this is employee table".

2.then how to provide the space between the column heading in output.

Thanks & regards,
Arunprabhu

[Updated on: Thu, 26 October 2006 04:08]

Report message to a moderator

Re: Table heading [message #199801 is a reply to message #199797] Thu, 26 October 2006 04:20 Go to previous messageGo to next message
Mohammad Taj
Messages: 2412
Registered: September 2006
Location: Dubai, UAE
Senior Member

[code]
may be you want column heading. user defined.

select ncode "This is employees code" from employees

or

Space between Column heading in output.
used '' or "" codes.
hope this helps.

thanx
Re: Table heading [message #199805 is a reply to message #199801] Thu, 26 October 2006 05:03 Go to previous message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
In SQL*plus you can use the TTITLE command.
SQL> set pages 120
SQL> ttitle "This the employees table:"
SQL> SELECT employee_id
  2       , last_name
  3  FROM   employees
  4  WHERE  rownum < 10;

Thu Oct 26                                                             page

                           This the employees table:

EMPLOYEE_ID LAST_NAME
----------- -------------------------
        100 King
        101 Kochhar
        102 De Haan
        103 Hunold
        104 Ernst
        105 Austin
        106 Pataballa
        107 Lorentz
        108 Greenberg

9 rows selected.

SQL> sho colsep
colsep " "
SQL> set colsep " -- "
SQL> SELECT employee_id
  2       , last_name
  3  FROM   employees
  4  WHERE  rownum < 10;

Thu Oct 26                                                             page

                           This the employees table:

EMPLOYEE_ID -- LAST_NAME
----------- -- -------------------------
        100 -- King
        101 -- Kochhar
        102 -- De Haan
        103 -- Hunold
        104 -- Ernst
        105 -- Austin
        106 -- Pataballa
        107 -- Lorentz
        108 -- Greenberg

9 rows selected.

SQL>
With colsep you can change the column separator. Don't forget to set the title off afterwards, because it will be repeated for each query and after the output exceeds the pagesize.

MHE
Previous Topic: Need Query Result
Next Topic: generic way of insertion
Goto Forum:
  


Current Time: Mon Dec 05 10:37:02 CST 2016

Total time taken to generate the page: 0.12111 seconds