Can we change alias name dynamically
452779Jun 26 2006 — edited Jun 26 2006Hi ALL,
I have a requirement in one of my report to change the Column Heading Dynamically based on column value.
eg : My query is like this
SELECT TO_CHAR(CONTROL_DATE, 'YYYY') "2006 YTD",
TO_CHAR(ADD_MONTHS(CONTROL_DATE, -12),'YYYY') as "2005 YTD"
FROM R_GRC_CONTROL WHERE CONTROL_ID = 2
---------------------------------------OUTPUT is in this format------------------------
2006 YTD 2005 YTD
2006 2005
---------------------------------------------------------------------------------------
Now what I want is column heading should change dynamically i.e "2006 YTD" next year it will like "2007 YTD" and so on.
------------------------------ Expected output next year---------------------------------------------
2007 YTD 2006 YTD
2007 2006
-------------------------------------------------------------------------------------------------------------------
So , is it possible to change the alias name dynamically based on column value?
Please advise
Many Thanks
Dikshit