Alias for a case statement in a SQL statement
djmantonApr 20 2004 — edited Mar 19 2008I want to use a case statement in the SQL for a cursor, and then use it in a cursor loop, but I cant find out how the name the column returned by the case statement, i.e. using
select
case
when to_char(sysdate,'MM') = '01' then 'January'
when to_char(sysdate,'MM') = '02' then 'Februray'
when to_char(sysdate,'MM') = '03' then 'March'
when to_char(sysdate,'MM') = '04' then 'April'
else 'Rest'
end case
from dual
with sqlplus the column is named 'CASE', but using the cursor in a cursor loop and using 'cursorloopvariable.case' gives an error. So how can I give the column a alias?