Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: column alias

Re: column alias

From: Arjan van Bentem <avbentem_at_DONT-YOU-DAREdds.nl>
Date: Thu, 6 May 1999 20:59:04 +0200
Message-ID: <7gsop5$oas$1@weber.a2000.nl>


weixingchen wrote
> I am trying to create a view with column name alias as
> the name of the current month, for example, a query
> of one such view will generate data like

No, you cannot do that as then the view should return different column names each month. And even if it would work: if you define an alias for a column name in your view, you also have to use that alias in your select. Like:

    select column1, may
    from my_view;

However, you may try (I am not too sure about the syntax of noprint, new_value and Mon...)

    set feedback off
    column myheader noprint new_value myheader     select to_char( sysdate, 'Mon' ) myheader     from dual;
    set feedback on

and then

    select column1 "column1"
    , column2 "&myheader"
    from my_table;

or maybe even

    column column1 heading "Column 1"
    column column2 heading "&myheader"

    select column1, column2
    from my_table;

Arjan. Received on Thu May 06 1999 - 13:59:04 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US