Re: SQL*Plus problem on COLUMN HEADING

From: John M. Reed Jr. <jmrjr_at_earthlink.net>
Date: Wed, 27 May 1998 13:09:01 -0600
Message-ID: <356C64CD.3906DC53_at_earthlink.net>


Pino,

You are close my friend. What you need to do is alias the column names in your select statment

ex:

col alias1 heading "Table A" format a6
col alias2 heading "Table B" format a6

select table1.col1 alias1, table2.col1 alias2   from table1, table2
 where ....some join condition ...

  • remember, you may also alias table names as well

ex:

select a.col1 alias1, b.col1 alias2
  from table1 a, table2 b
 where ...some join condition ....

Good luck,

John M. Reed Jr.
Developer/Database Administrator

Pino Venturella wrote:

> Hi All,
> I have 2 tables with 2 columns with the same name.
> I'd like to use SQL*Plus to get a 'nice output' so I wrote a file called
> nametest.sql where I put
>
> COLUMN NAME HEADING WrongHead
> COLUMN TABPREFIX.TABNAME1.NAME HEADING Name1
> COLUMN TABPREFIX.TABNAME2.NAME HEADING Name2
> select TABPREFIX.TABNAME1.NAME, TABPREFIX.TABNAME2.NAME from
> TABPREFIX.TABNAME1, TABPREFIX.TABNAME2;
>
> Then at SQL> prompt I write _at_nametest and I'd like to see 2 columns with
> headers Name1 and Name2 but I see that for both columns the header is
> WrongHead.
>
> Is there any way to solve my problem? Am I doing something wrong?
> Pls if this is not the rigth newsgroup point me to the rigth one.
>
> Thanks in advance, Pino
Received on Wed May 27 1998 - 21:09:01 CEST

Original text of this message