Home » SQL & PL/SQL » SQL & PL/SQL » Column Headings
Column Headings [message #224819] Thu, 15 March 2007 10:47 Go to next message
mutznutz22
Messages: 4
Registered: March 2007
Junior Member
Ive got a problem with some code that i need to produce. Ive got a load of columns that i need to display using a 'view'. I have to call this view from a different select statement. I have all this working fine but want to rename the column headings so they are a bit more meaningful.

Do i have to but the ----( COLUMN pat.oname FORMAT A10 HEADING 'First Name' )---- In the view or in the select statement.

Im using Oracle SQL* Plus.

Any help would be great.

Cheers

Dave
Re: Column Headings [message #224825 is a reply to message #224819] Thu, 15 March 2007 10:55 Go to previous messageGo to next message
rajavu1
Messages: 1574
Registered: May 2005
Location: Bangalore , India
Senior Member

You mean something like ,

select  pat.oname "First Name"
from Patient pat ;


??
Thumbs Up
Rajuvan.
Re: Column Headings [message #224826 is a reply to message #224819] Thu, 15 March 2007 10:57 Go to previous messageGo to next message
mutznutz22
Messages: 4
Registered: March 2007
Junior Member
basically i need to do it with a column heading rather than an alias.

i know that the code will be something like

COLUMN pat.oname FORMAT A10 HEADING 'First Name'

but wherever i put it it doesnt change any of the heading on output
Re: Column Headings [message #224827 is a reply to message #224826] Thu, 15 March 2007 11:08 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
mutznutz22 wrote on Thu, 15 March 2007 16:57
basically i need to do it with a column heading rather than an alias.

Why? What is the difference, you think?
Re: Column Headings [message #224829 is a reply to message #224819] Thu, 15 March 2007 11:12 Go to previous messageGo to next message
mutznutz22
Messages: 4
Registered: March 2007
Junior Member
its just how ive been told how i have to do it. i need the column heading to be a set width rather than wrap around. if not do you know how i can stop it wrapping around if i use an alias.
Re: Column Headings [message #224843 is a reply to message #224819] Thu, 15 March 2007 12:39 Go to previous messageGo to next message
Bill B
Messages: 1482
Registered: December 2004
Senior Member
The column command may NOT be used in sql. It is a sql*plus command only. See the following link

http://download-east.oracle.com/docs/cd/B10501_01/server.920/a90842/ch7.htm#1005594
Re: Column Headings [message #224844 is a reply to message #224826] Thu, 15 March 2007 12:41 Go to previous message
Littlefoot
Messages: 20891
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
mutznutz2

COLUMN pat.oname FORMAT A10 HEADING 'First Name'

but wherever i put it it doesnt change any of the heading on output

Remove pat. and you'll get it. Table alias shouldn't be part of the column formatting command.
SQL> column pat.ename format a10 heading "First name"
SQL> select pat.ename from emp pat;

ENAME
----------
SMITH
ALLEN
...
14 rows selected.

SQL>
SQL> column ename format a10 heading "First name"
SQL> select pat.ename from emp pat;

First name
----------
SMITH
ALLEN
...
14 rows selected.

SQL>
Previous Topic: How to display rows in stored procedure?
Next Topic: Create sequence.
Goto Forum:
  


Current Time: Sun Dec 04 20:58:52 CST 2016

Total time taken to generate the page: 0.08606 seconds