Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Alias for a case statement in a SQL statement

djmantonApr 20 2004 — edited Mar 19 2008
I 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?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 18 2004
Added on Apr 20 2004
4 comments
8,960 views