Sie sind auf Seite 1von 2

Write a procedure to calculate gross salary of the employee.

create table student_marks ( roll number(3), m1 number(3), m2 number(3), m3 number(3) ); create or replace procedure markheet1 as rno number(3); res varchar2(5); clss varchar2(6); tot number(3); per number(7,2); a number(3); b number(3); c number(3); begin rno:=&rno; select m1,m2,m3 into a,b,c from student_marks where roll=rno; if a<35 or b<35 or c<35 then res:='FAIL'; else res:='PASS'; end if; tot:=a+b+c; per:=tot/3; if per>=60 then clss:=' FIRST'; elsif per<60 and per>=45 then clss:='second'; elsif per>=35 and per<45 then clss:=' THIRD'; else clss:=' NA'; end if;

dbms_output.put_line('MARKSHEET'); dbms_output.put_line('| PAPER 1 PAPER 2 PAPER 3 |'); dbms_output.put_line('| '||a||' '||b||' '||c||' |'); dbms_output.put_line(' '); dbms_output.put_line('. '||' TOTAL:'||tot||' PERCENT:'||per||' CLASS:'||clss||' '); dbms_output.put_line(' '); dbms_output.put_line('| RESULT:'||res||' '||'|'); end; Execute function marksheet1 exec markheet1; Output:MARKSHEET | PAPER 1 PAPER 2 PAPER 3 | | 99 99 99 | TOTAL:297 PERCENT:99 CLASS: FIRST | RESULT:PASS | PL/SQL procedure successfully completed.

Das könnte Ihnen auch gefallen