Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: column alias
You could also use the SQL*Plus "decode" statement to accomplish this. I'm not going to research the details as to how -- just point you in this direction... I'd have fun doing this -- and miss the ability if I was using Informix... :)
David Russell
On Thu, 6 May 1999 20:59:04 +0200, "Arjan van Bentem" <avbentem_at_DONT-YOU-DAREdds.nl> wrote:
>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 Tue May 18 1999 - 18:32:39 CDT
![]() |
![]() |