Sunday, 9 June 2013

PL/SQL program to show Case statement

Creating the table:

Create table lecturer29(lid varchar2(10),major_sub varchar2(10));

Inserting values in the table:

Insert into lecturer29(lid,major_sub) values('l001','computer');

Code Block:

select lid,major_sub,
case major_sub
when 'computer' then 'BSC(cs)'
when 'accounts' then 'BCom'
when 'photography' then 'BMM'
when NULL then 'BMS'
else 'no course mentioned'
end as course
from lecturer29;

No comments:

Post a Comment