Friday, 16 May 2014

using case in plsql part3


DECLARE
l_maths number;
l_eng number;
l_hindi number;
l_sci number;
l_soc number;
l_san number;
l_tot_mars number;
mark_percent number;
grade number :=100;
BEGIN

select maths,eng,hindi,sci,soc,san,tot_mars into l_maths,l_eng,l_hindi,l_sci,l_soc,l_san,l_tot_mars
from student where stud_id = :v_stud_id;

mark_percent := l_tot_mars/ 600;

 CASE
 
   when (mark_percent >= 75) then             dbms_output.put_line('Excellent');
   when mark_percent <=75 and mark_percent >=60 then dbms_output.put_line('Very good');
   when mark_percent <=60 and mark_percent >=50 then dbms_output.put_line('Well done');
   when mark_percent <=50 and mark_percent >=40 then dbms_output.put_line('You passed');
   when mark_percent <=40 and mark_percent >=35 then dbms_output.put_line('Better try again');
   else dbms_output.put_line('No such grade');
   END CASE;

END stud_pro;

No comments:

Post a Comment

Note: only a member of this blog may post a comment.