Pl SQL new

delimiter $


create procedure fine_calculation(IN rno int(3), bname char(20)) 


begin


declare i_date date;


declare diff int:


declare fine_amt int;


declare exit handler for sqlexception select 'Table not Found'; 

select dateofIssue into i_date from borrower where rollin = rno and bname = bname


select datediff(curdate(),i_date) into diff;


if(diff>15 and diff<=38) then


set fine_amt = diff*5;


insert into fine values(rno, curdate(), fine_amt);


elseif(diff>30) then


set fine_amt - 15*5 + (diff-30)*50;

insert into fine values(rno, curdate(), fine_amt);


end if; 

update borrower set status ='R' where rollin=rno and bname bname;


end;

$

Comments

Popular posts from this blog

DREAM LEAGUE SOCCER 2019 MOD

10 CL3

Garena Contra Return