The document describes requirements for a PL/SQL code block to handle library book borrowing and fines. It includes:
1) Accepting a roll number and book name from the user.
2) Checking the number of days since issue date and calculating fines as Rs. 5 per day if between 15-30 days, or Rs. 50 per day if over 30 days.
3) Updating the book status to "returned" and inserting any fine details into the fine table.
The problem is to write a PL/SQL code block that meets these requirements using control structures, exception handling, and by referencing the Borrower and Fine tables.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
54 views3 pages
4 & 5
The document describes requirements for a PL/SQL code block to handle library book borrowing and fines. It includes:
1) Accepting a roll number and book name from the user.
2) Checking the number of days since issue date and calculating fines as Rs. 5 per day if between 15-30 days, or Rs. 50 per day if over 30 days.
3) Updating the book status to "returned" and inserting any fine details into the fine table.
The problem is to write a PL/SQL code block that meets these requirements using control structures, exception handling, and by referencing the Borrower and Fine tables.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3
-- Unnamed PL/SQL code block: Use of Control structure and Exception handling is
mandatory. Write a PL/SQL block of code for the following requirements:-
-- Schema: -- 1. Borrower(Rollin, Name, DateofIssue, NameofBook, Status) -- 2. Fine(Roll_no,Date,Amt) -- - [ ] Accept roll_no & name of book from user. -- - [ ] Check the number of days (from date of issue), if days are between 15 to 30 then fine -- amount will be Rs 5per day. -- - [ ] If no. of days>30, per day fine will be Rs 50 per day & for days less than 30, Rs. 5 per -- day. -- - [ ] After submitting the book, status will change from I to R. -- - [ ] If condition of fine is true, then details will be stored into fine table. -- Frame the problem statement for writing PL/SQL block inline with above statement.
-- Author: Mohit Khedkar
mysql> use mohitDB;
Reading table information for completion of table and column
names You can turn off this feature to get a quicker startup with -A Database changed
mysql> delimiter //
mysql> call B1(1,'TOC')
-> // +-----------+ | NOT FOUND | +-----------+ | NOT FOUND | +-----------+ 1 row in set (0.35 sec) Query OK, 0 rows affected (0.41 sec) mysql> select * from Borrower; -> // +---------+-----------+-----------+-----------+----------+ | roll_no | name | DOI | book_name | status | +---------+-----------+-----------+-----------+----------+ | 12 | patel | 2020-07-01 | xyz | issued | | 14 | shinde | 2020-06-01 | oop | issued | | 16 | bhangale | 2020-05-01 | coa | returned | | 18 | rebello | 2020-06-15 | toc | returned | | 20 | patil | 2020-05-15 | mp | issued | +---------+----------+------------+-----------+----------+ 5 rows in set (0.00 sec) mysql> show tables; -> // +-------------------+ | Tables_in_mohitDB | +-------------------+ | Borrower | | Employee | | Fine | | TE | | _master | | auto | | c_master | | capital | | customer | | orders | | person | | product_master | | state | +-------------------+ 13 rows in set (0.00 sec)