Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: column alias
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
![]() |
![]() |