SlideShare uma empresa Scribd logo
1 de 2
Baixar para ler offline
Practical No: 5
Problem Statement: 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.
Database changed
mysql> show tables;
+-----------------+
| Tables_in_prac5 |
+-----------------+
| Borrower |
| Fine |
+-----------------+
2 rows in set (0.00 sec)
mysql> desc Borrower;
+--------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+-------------+------+-----+---------+-------+
| Rollin | int(12) | NO | PRI | NULL | |
| Name | varchar(25) | YES | | NULL | |
| DateOfIsssue | date | YES | | NULL | |
| Nameofbook | varchar(25) | YES | | NULL | |
| Status | varchar(3) | YES | | NULL | |
+--------------+-------------+------+-----+---------+-------+
5 rows in set (0.00 sec)
mysql> desc Fine;
+--------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+---------+------+-----+---------+-------+
| Rollno | int(12) | NO | PRI | NULL | |
| Date | date | YES | | NULL | |
| Amt | int(12) | YES | | NULL | |
+--------+---------+------+-----+---------+-------+
3 rows in set (0.00 sec)
mysql> select * From Borrower;
+--------+--------+--------------+------------+--------+
| Rollin | Name | DateOfIsssue | Nameofbook | Status |
+--------+--------+--------------+------------+--------+
| 1 | Rahul | 2019-07-13 | dbms | I |
| 2 | Rakesh | 2019-07-28 | sql | I |
| 33 | Aadil | 2019-05-13 | toc | I |
| 85 | Akbar | 2019-06-20 | java | I |
+--------+--------+--------------+------------+--------+
4 rows in set (0.00 sec)
mysql> select * From Fine;
Empty set (0.00 sec)
dilimiter $
mysql> create procedure calfine(Rollno int(20),name varchar(50))
begin
declare ldate date;
declare fine int(20);
declare day int(20);
select DateOfIsssue into ldate from Borrower where Rollin=Rollno and
Nameofbook=name;
set day = DATEDIFF(CURDATE(),ldate);
IF(day>=15 and day<=30) then
set fine=day*5;
ELSEIF(day>30) then
set fine=day*50;
end IF;
update Borrower set Status='R' where Rollin=Rollno and Nameofbook=name;
IF(fine is not null) then
insert into Fine values(Rollno,CURDATE(),fine);
end IF;
end $
mysql> call calfine(33,'toc')$
Query OK, 1 row affected (0.03 sec)
mysql> select * from Fine$
+--------+------------+------+
| Rollno | Date | Amt |
+--------+------------+------+
| 33 | 2019-08-07 | 4300 |
+--------+------------+------+
1 row in set (0.00 sec)
mysql> call calfine(2,'sql')$
Query OK, 1 row affected (0.36 sec)
mysql> call calfine(1,'dbms')$
Query OK, 1 row affected (0.34 sec)
mysql> select * from Borrower$
+--------+--------+--------------+------------+--------+
| Rollin | Name | DateOfIsssue | Nameofbook | Status |
+--------+--------+--------------+------------+--------+
| 1 | Rahul | 2019-07-13 | dbms | R |
| 2 | Rakesh | 2019-07-28 | sql | R |
| 33 | Aadil | 2019-05-13 | toc | R |
| 85 | Akbar | 2019-06-20 | java | I |
+--------+--------+--------------+------------+--------+
4 rows in set (0.00 sec)
mysql> select * from Fine$
+--------+------------+------+
| Rollno | Date | Amt |
+--------+------------+------+
| 1 | 2019-08-07 | 125 |
| 33 | 2019-08-07 | 4300 |
+--------+------------+------+
2 rows in set (0.00 sec)

Mais conteúdo relacionado

Mais procurados

object oriented methodologies
object oriented methodologiesobject oriented methodologies
object oriented methodologiesAmith Tiwari
 
Library Management System
Library Management SystemLibrary Management System
Library Management SystemAditya Shah
 
DAA Lab File C Programs
DAA Lab File C ProgramsDAA Lab File C Programs
DAA Lab File C ProgramsKandarp Tiwari
 
Internet programming lab manual
Internet programming lab manualInternet programming lab manual
Internet programming lab manualinteldualcore
 
Issues in knowledge representation
Issues in knowledge representationIssues in knowledge representation
Issues in knowledge representationSravanthi Emani
 
Aggregate functions
Aggregate functionsAggregate functions
Aggregate functionssinhacp
 
Learning Management System-SRS Modified(Semi-Final)
Learning Management System-SRS Modified(Semi-Final)Learning Management System-SRS Modified(Semi-Final)
Learning Management System-SRS Modified(Semi-Final)Sharon Varghese
 
e-commerce web development project report (Bookz report)
e-commerce web development project report (Bookz report)e-commerce web development project report (Bookz report)
e-commerce web development project report (Bookz report)Mudasir Ahmad Bhat
 
Phone book with project report for BCA,MCA
Phone book with project report for BCA,MCAPhone book with project report for BCA,MCA
Phone book with project report for BCA,MCASp Gurjar
 
Student result mamagement
Student result mamagementStudent result mamagement
Student result mamagementMickey
 
Context model
Context modelContext model
Context modelUbaid423
 

Mais procurados (20)

object oriented methodologies
object oriented methodologiesobject oriented methodologies
object oriented methodologies
 
Library Management System
Library Management SystemLibrary Management System
Library Management System
 
Google App Engine
Google App EngineGoogle App Engine
Google App Engine
 
DBMS Practical File
DBMS Practical FileDBMS Practical File
DBMS Practical File
 
DAA Lab File C Programs
DAA Lab File C ProgramsDAA Lab File C Programs
DAA Lab File C Programs
 
Internet programming lab manual
Internet programming lab manualInternet programming lab manual
Internet programming lab manual
 
Issues in knowledge representation
Issues in knowledge representationIssues in knowledge representation
Issues in knowledge representation
 
Sql fundamentals
Sql fundamentalsSql fundamentals
Sql fundamentals
 
Aggregate functions
Aggregate functionsAggregate functions
Aggregate functions
 
Learning Management System-SRS Modified(Semi-Final)
Learning Management System-SRS Modified(Semi-Final)Learning Management System-SRS Modified(Semi-Final)
Learning Management System-SRS Modified(Semi-Final)
 
Bank management system
Bank management systemBank management system
Bank management system
 
Ado.Net Tutorial
Ado.Net TutorialAdo.Net Tutorial
Ado.Net Tutorial
 
e-commerce web development project report (Bookz report)
e-commerce web development project report (Bookz report)e-commerce web development project report (Bookz report)
e-commerce web development project report (Bookz report)
 
Dbms lab questions
Dbms lab questionsDbms lab questions
Dbms lab questions
 
Phone book with project report for BCA,MCA
Phone book with project report for BCA,MCAPhone book with project report for BCA,MCA
Phone book with project report for BCA,MCA
 
Student result mamagement
Student result mamagementStudent result mamagement
Student result mamagement
 
Context model
Context modelContext model
Context model
 
Sql queries
Sql queriesSql queries
Sql queries
 
Library doc
Library docLibrary doc
Library doc
 
grocery management system
grocery  management systemgrocery  management system
grocery management system
 

Semelhante a 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

Applied Partitioning And Scaling Your Database System Presentation
Applied Partitioning And Scaling Your Database System PresentationApplied Partitioning And Scaling Your Database System Presentation
Applied Partitioning And Scaling Your Database System PresentationRichard Crowley
 
Advanced Query Optimizer Tuning and Analysis
Advanced Query Optimizer Tuning and AnalysisAdvanced Query Optimizer Tuning and Analysis
Advanced Query Optimizer Tuning and AnalysisMYXPLAIN
 
Need for Speed: MySQL Indexing
Need for Speed: MySQL IndexingNeed for Speed: MySQL Indexing
Need for Speed: MySQL IndexingMYXPLAIN
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012Roland Bouman
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012Roland Bouman
 
Building advanced data-driven applications
Building advanced data-driven applicationsBuilding advanced data-driven applications
Building advanced data-driven applicationsMariaDB plc
 
Window functions in MySQL 8.0
Window functions in MySQL 8.0Window functions in MySQL 8.0
Window functions in MySQL 8.0Mydbops
 
Writing efficient sql
Writing efficient sqlWriting efficient sql
Writing efficient sqlj9soto
 
DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018
DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018
DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018teachersduniya.com
 
Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingPerformance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingSveta Smirnova
 
Introduction To Lamp P2
Introduction To Lamp P2Introduction To Lamp P2
Introduction To Lamp P2Amzad Hossain
 
MySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptxMySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptxNeoClova
 
Date data type and Globalization in Oracle
Date data type and Globalization in OracleDate data type and Globalization in Oracle
Date data type and Globalization in OracleMasoud Haji Hassan Pour
 
Percona live-2012-optimizer-tuning
Percona live-2012-optimizer-tuningPercona live-2012-optimizer-tuning
Percona live-2012-optimizer-tuningSergey Petrunya
 
4. Data Manipulation.ppt
4. Data Manipulation.ppt4. Data Manipulation.ppt
4. Data Manipulation.pptKISHOYIANKISH
 
Parallel Query in AWS Aurora MySQL
Parallel Query in AWS Aurora MySQLParallel Query in AWS Aurora MySQL
Parallel Query in AWS Aurora MySQLMydbops
 
MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)
MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)
MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)Valeriy Kravchuk
 
Oracle Database Performance Tuning Basics
Oracle Database Performance Tuning BasicsOracle Database Performance Tuning Basics
Oracle Database Performance Tuning Basicsnitin anjankar
 

Semelhante a 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 (20)

Applied Partitioning And Scaling Your Database System Presentation
Applied Partitioning And Scaling Your Database System PresentationApplied Partitioning And Scaling Your Database System Presentation
Applied Partitioning And Scaling Your Database System Presentation
 
Advanced Query Optimizer Tuning and Analysis
Advanced Query Optimizer Tuning and AnalysisAdvanced Query Optimizer Tuning and Analysis
Advanced Query Optimizer Tuning and Analysis
 
Need for Speed: MySQL Indexing
Need for Speed: MySQL IndexingNeed for Speed: MySQL Indexing
Need for Speed: MySQL Indexing
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012
 
Building advanced data-driven applications
Building advanced data-driven applicationsBuilding advanced data-driven applications
Building advanced data-driven applications
 
Window functions in MySQL 8.0
Window functions in MySQL 8.0Window functions in MySQL 8.0
Window functions in MySQL 8.0
 
Writing efficient sql
Writing efficient sqlWriting efficient sql
Writing efficient sql
 
DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018
DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018
DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018
 
Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingPerformance Schema for MySQL Troubleshooting
Performance Schema for MySQL Troubleshooting
 
Explain
ExplainExplain
Explain
 
Introduction To Lamp P2
Introduction To Lamp P2Introduction To Lamp P2
Introduction To Lamp P2
 
MySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptxMySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptx
 
Date data type and Globalization in Oracle
Date data type and Globalization in OracleDate data type and Globalization in Oracle
Date data type and Globalization in Oracle
 
Percona live-2012-optimizer-tuning
Percona live-2012-optimizer-tuningPercona live-2012-optimizer-tuning
Percona live-2012-optimizer-tuning
 
4. Data Manipulation.ppt
4. Data Manipulation.ppt4. Data Manipulation.ppt
4. Data Manipulation.ppt
 
Parallel Query in AWS Aurora MySQL
Parallel Query in AWS Aurora MySQLParallel Query in AWS Aurora MySQL
Parallel Query in AWS Aurora MySQL
 
MySQL SQL Tutorial
MySQL SQL TutorialMySQL SQL Tutorial
MySQL SQL Tutorial
 
MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)
MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)
MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)
 
Oracle Database Performance Tuning Basics
Oracle Database Performance Tuning BasicsOracle Database Performance Tuning Basics
Oracle Database Performance Tuning Basics
 

Mais de bhavesh lande

The Annual G20 Scorecard – Research Performance 2019
The Annual G20 Scorecard – Research Performance 2019 The Annual G20 Scorecard – Research Performance 2019
The Annual G20 Scorecard – Research Performance 2019 bhavesh lande
 
information control and Security system
information control and Security systeminformation control and Security system
information control and Security systembhavesh lande
 
information technology and infrastructures choices
information technology and  infrastructures choicesinformation technology and  infrastructures choices
information technology and infrastructures choicesbhavesh lande
 
ethical issues,social issues
 ethical issues,social issues ethical issues,social issues
ethical issues,social issuesbhavesh lande
 
managing inforamation system
managing inforamation systemmanaging inforamation system
managing inforamation systembhavesh lande
 
• E-commerce, e-business ,e-governance
• E-commerce, e-business ,e-governance• E-commerce, e-business ,e-governance
• E-commerce, e-business ,e-governancebhavesh lande
 
organisations and information systems
organisations and  information systemsorganisations and  information systems
organisations and information systemsbhavesh lande
 
IT stratergy and digital goods
IT stratergy and digital goodsIT stratergy and digital goods
IT stratergy and digital goodsbhavesh lande
 
Implement Mapreduce with suitable example using MongoDB.
 Implement Mapreduce with suitable example using MongoDB. Implement Mapreduce with suitable example using MongoDB.
Implement Mapreduce with suitable example using MongoDB.bhavesh lande
 
applications and advantages of python
applications and advantages of pythonapplications and advantages of python
applications and advantages of pythonbhavesh lande
 
introduction of python in data science
introduction of python in data scienceintroduction of python in data science
introduction of python in data sciencebhavesh lande
 
data scientists and their role
data scientists and their roledata scientists and their role
data scientists and their rolebhavesh lande
 
statistics techniques to deal with data
statistics techniques to deal with datastatistics techniques to deal with data
statistics techniques to deal with databhavesh lande
 
introduction to data science
introduction to data scienceintroduction to data science
introduction to data sciencebhavesh lande
 

Mais de bhavesh lande (18)

The Annual G20 Scorecard – Research Performance 2019
The Annual G20 Scorecard – Research Performance 2019 The Annual G20 Scorecard – Research Performance 2019
The Annual G20 Scorecard – Research Performance 2019
 
information control and Security system
information control and Security systeminformation control and Security system
information control and Security system
 
information technology and infrastructures choices
information technology and  infrastructures choicesinformation technology and  infrastructures choices
information technology and infrastructures choices
 
ethical issues,social issues
 ethical issues,social issues ethical issues,social issues
ethical issues,social issues
 
managing inforamation system
managing inforamation systemmanaging inforamation system
managing inforamation system
 
• E-commerce, e-business ,e-governance
• E-commerce, e-business ,e-governance• E-commerce, e-business ,e-governance
• E-commerce, e-business ,e-governance
 
IT and innovations
 IT and  innovations  IT and  innovations
IT and innovations
 
organisations and information systems
organisations and  information systemsorganisations and  information systems
organisations and information systems
 
IT stratergy and digital goods
IT stratergy and digital goodsIT stratergy and digital goods
IT stratergy and digital goods
 
Implement Mapreduce with suitable example using MongoDB.
 Implement Mapreduce with suitable example using MongoDB. Implement Mapreduce with suitable example using MongoDB.
Implement Mapreduce with suitable example using MongoDB.
 
working with python
working with pythonworking with python
working with python
 
applications and advantages of python
applications and advantages of pythonapplications and advantages of python
applications and advantages of python
 
introduction of python in data science
introduction of python in data scienceintroduction of python in data science
introduction of python in data science
 
tools
toolstools
tools
 
data scientists and their role
data scientists and their roledata scientists and their role
data scientists and their role
 
applications
applicationsapplications
applications
 
statistics techniques to deal with data
statistics techniques to deal with datastatistics techniques to deal with data
statistics techniques to deal with data
 
introduction to data science
introduction to data scienceintroduction to data science
introduction to data science
 

Último

Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGSIVASHANKAR N
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 

Último (20)

Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 

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

  • 1. Practical No: 5 Problem Statement: 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. Database changed mysql> show tables; +-----------------+ | Tables_in_prac5 | +-----------------+ | Borrower | | Fine | +-----------------+ 2 rows in set (0.00 sec) mysql> desc Borrower; +--------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------+-------------+------+-----+---------+-------+ | Rollin | int(12) | NO | PRI | NULL | | | Name | varchar(25) | YES | | NULL | | | DateOfIsssue | date | YES | | NULL | | | Nameofbook | varchar(25) | YES | | NULL | | | Status | varchar(3) | YES | | NULL | | +--------------+-------------+------+-----+---------+-------+ 5 rows in set (0.00 sec) mysql> desc Fine; +--------+---------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------+---------+------+-----+---------+-------+ | Rollno | int(12) | NO | PRI | NULL | | | Date | date | YES | | NULL | | | Amt | int(12) | YES | | NULL | | +--------+---------+------+-----+---------+-------+ 3 rows in set (0.00 sec) mysql> select * From Borrower; +--------+--------+--------------+------------+--------+ | Rollin | Name | DateOfIsssue | Nameofbook | Status | +--------+--------+--------------+------------+--------+ | 1 | Rahul | 2019-07-13 | dbms | I | | 2 | Rakesh | 2019-07-28 | sql | I | | 33 | Aadil | 2019-05-13 | toc | I | | 85 | Akbar | 2019-06-20 | java | I | +--------+--------+--------------+------------+--------+ 4 rows in set (0.00 sec) mysql> select * From Fine; Empty set (0.00 sec)
  • 2. dilimiter $ mysql> create procedure calfine(Rollno int(20),name varchar(50)) begin declare ldate date; declare fine int(20); declare day int(20); select DateOfIsssue into ldate from Borrower where Rollin=Rollno and Nameofbook=name; set day = DATEDIFF(CURDATE(),ldate); IF(day>=15 and day<=30) then set fine=day*5; ELSEIF(day>30) then set fine=day*50; end IF; update Borrower set Status='R' where Rollin=Rollno and Nameofbook=name; IF(fine is not null) then insert into Fine values(Rollno,CURDATE(),fine); end IF; end $ mysql> call calfine(33,'toc')$ Query OK, 1 row affected (0.03 sec) mysql> select * from Fine$ +--------+------------+------+ | Rollno | Date | Amt | +--------+------------+------+ | 33 | 2019-08-07 | 4300 | +--------+------------+------+ 1 row in set (0.00 sec) mysql> call calfine(2,'sql')$ Query OK, 1 row affected (0.36 sec) mysql> call calfine(1,'dbms')$ Query OK, 1 row affected (0.34 sec) mysql> select * from Borrower$ +--------+--------+--------------+------------+--------+ | Rollin | Name | DateOfIsssue | Nameofbook | Status | +--------+--------+--------------+------------+--------+ | 1 | Rahul | 2019-07-13 | dbms | R | | 2 | Rakesh | 2019-07-28 | sql | R | | 33 | Aadil | 2019-05-13 | toc | R | | 85 | Akbar | 2019-06-20 | java | I | +--------+--------+--------------+------------+--------+ 4 rows in set (0.00 sec) mysql> select * from Fine$ +--------+------------+------+ | Rollno | Date | Amt | +--------+------------+------+ | 1 | 2019-08-07 | 125 | | 33 | 2019-08-07 | 4300 | +--------+------------+------+ 2 rows in set (0.00 sec)