Dynamic column alias
Could anyone help me how to write a sql where I can have dynamic column alias.
I am writing a sql for ageing report where my column alias has to display the month that its corresponding column calculates the value for the month. I am calculating for 12 months starting from current month. So column header should display the month.
thanks in advance
Leave a comment...
- 3 Comments
- There is not such concept as dynamic columns labels in a SQL projection. Or variable number of columns.
The column labels must be specified up front. The number of columns must be known up front. These cannot be specified during the SQL execution as conditional logic.
You can however use conditional logic (e.g. DECODE or CASE functions) to create a column for each month's totals.#1; Sat, 23 Feb 2008 12:30:00 GMT
- Dear Friend,
I too have come across such scenario. I have followed one logic which is as follows.
pass parameter which is taken from the input. I came across the following scenario.
for example if the Organization = India_org and SOB = india_sob then the currency Code alias should be "Currency INR".
take the above condition in a query into report input parameter.
then give the column heading
column currency_code heading 'Currency &&1'
This has worked for me.
try it out and let me know.
Have a Nice Day.
Thanks & Regards,
Ahmed#2; Sat, 23 Feb 2008 12:31:00 GMT
- Yu can also refer to this thread:#3; Sat, 23 Feb 2008 12:32:00 GMT