0% found this document useful (0 votes)
7 views

Library Procedure Assignment5

Uploaded by

samwakchaure2511
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Library Procedure Assignment5

Uploaded by

samwakchaure2511
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

create or replace procedure book(r in number)

as
c number;
begin
select to_number(trunc(sysdate-doi)) into c from Borr where rollno=r;
if c >=15 and c<=30 then
c:=c-15;
insert into fine values (r,sysdate,'');
update fine set amt=c*5 where rollno=r;
elsif c>30 then
c:=c-30;
insert into fine values (r,sysdate,'');
update fine set amt=(c*50)+75 where rollno=r;
end if;
update Borr set status='R' where rollno=r;

EXCEPTION
WHEN no_data_found THEN
dbms_output.put_line('No such Rollno !');
end;

------------------------------------------------------------------------------
how to inserting a date in table
insert into borr values (4,'shyam', to_date('20230629','yyyymmdd'), 'CN','I');

Borrower(rollno, name, DOI, BookName, status)


Fine(rollno, date, amt)

d Borr.doi%type;
dbms_output.put_line(c);

dbms_output.put_line(c);

insert into borro values (4,'shyam', to_date('20170629','yyyymmdd'), 'CN','I');

create or replace procedure demo(r in number)


as
rn stud1.rollno%type;
nm stud1.name%type;
begin
select rollno, name into rn, nm from stud1 where rollno=r;
dbms_output.put_line(rn||' '||nm);
end;

create or replace procedure demo4(r in number)


as
rn stud.rollno%type;
nm stud.name%type;
begin
select rollno, name into rn, nm from stud where rollno=r;
dbms_output.put_line(rn|| ' ' || nm);
end;

begin
book(5);
end;

declare
begin
demo;
end;

You might also like