Documente Academic
Documente Profesional
Documente Cultură
nam tb_reg.name%type;
pho tb_reg.phone%type;
mar1 tb_sem1.mark1%type;
mar2 tb_sem1.mark2%type;
mar3 tb_sem1.mark3%type;
tot tb_sem.tota%type;
avg1 tb_sem.av%type;
grad tb_sem.grade%type;
res tb_sem.result%type;
procedure px(rno tb_reg.regno%type,nam out tb_reg.name%type,pho out
tb_reg.phone%type)is
begin
select name,phone into nam,pho from tb_reg where regno=rno;
end px;
procedure py(rno tb_reg.regno%type,nam out tb_reg.name%type,
mar1 out tb_sem1.mark1%type,mar2 out tb_sem1.mark2%type,mar3 out
tb_sem1.mark3%type)is
begin
select a.name,b.mark1,b.mark2,b.mark3 into nam,mar1,mar2,mar3 from tb_reg
a,tb_sem1 b where a.regno=b.regno and a.regno=rno;
insert into tb_sem1(regno,mark1,mark2,mark3)values(rno,mar1,mar2,mar3);
end py;
function fx(rno tb_reg.regno%type)return varchar is
begin
select mark1,mark2,mark3 into mar1,mar2,mar3 from tb_sem1 where
regno=rno;
tot:=mar1+mar2+mar3;
avg1:=round(tot/3,2);
if(mar1>40 and mar2>40 and mar3>40)then
res:='pass';
if(avg1>=60) then
grad:='f class';
elsif(avg1>=45 and avg1<60)then
grad:='s class';
else
grad:='t class';
end if;
update tb_sem1 set tota=tot,av=avg1,grade=grad,result=res where
regno=rno;
commit;
else
res:='fail';
grad:='no';
update tb_sem1 set tota=tot,av=avg1,grade=grad,result=res where
regno=rno;
commit;
end if;
return grad;
end fx;
end;
-------------primary constraint