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 [Link]%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 [Link]%type;
nm [Link]%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 [Link]%type;
nm [Link]%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;