You are on page 1of 1

ASSIGMENT NO 6:

Assignment Title :
Named PL/SQL Block: PL/SQL Stored Procedure and Stored Function.
Write a Stored Procedure namely proc_Grade for the categorization of students. If
marks scored by students in examination is <=1500 and marks>=990 then students will
be placed in distinction category if marks scored are between 989 and900 category
is first class, if marks 899 n 825 category is Higher Second Class. Write a
PL/SQLblock to use procedures created with the above requirement.

CODE:
Stud_Marks(name, total_marks) Result(Roll,Name, Class)

create table stud_marks(name1 varchar2(20),total_marks number(5))

create table result(roll number(3),name1 varchar2(20),class1 varchar2(20))

create or replace procedure proc_Grade(rno number, name1 varchar2,marks number) is


class1 varchar2(20);
begin
if(marks<=1500 and marks>=990) then
class1:='Distinction';
elsif(marks<=989 and marks >=900) then
class1 := 'First';
elsif(marks<=899 and marks>=825) then
class1 :='Higher second';
end if;
insert into stud_marks values(name1,marks);
insert into result values(rno,name1,class1);
end;

exec proc_Grade(1,'Sam',1000)

select * from stud_marks

select * from result

exec proc_Grade(20,'Avi',1200)

select * from stud_marks

select * from stud_marks

select * from result

You might also like