Tuesday, June 3, 2008

Using a column heading as a variable

We can use a column heading as a 'sql' variable.
Which i can then define and use elsewhere which can be handy.

--Define the column heading:
column myreportsec new_value myreportsec noprint;

--Now select something into the column header
set heading off
set feedback off
select case when '&1' = 'EUZ' then 'Tranches '
when '&1' = 'EUU' then 'Options '
when '&1' = 'EUP' then 'Bespoke '
else 'no sector' end myreportsec
from dual;
set heading on
set feedback on

--Now we can define a variable using this column header
define reptitle="&myreportsec Report"

No comments: