Question: Enable auto increment for rental numbers in the RENTAL table. Start the values with 1 1 0 0 . Create a stored procedure named prc
Enable auto increment for rental numbers in the RENTAL table. Start the values with
Create a stored procedure named prcnewrentalto insert new rows in the RENTAL table. The procedure should satisfy the following conditions:
The membership number will be provided as a parameter.
Use a Count function to verify that the membership number exists in the MEMBERSHIP table. If it does not exist, then a message should be
displayed that the membership does not exist and no data should be written to the database.
If the membership does exist, then retrieve the membership balance and display a message that the balance amount is the previous balance.
Eg if the membership has a balance of $ then display "Previous balance: $
Insert a new row in the rental table using the current system date for the RENTDATE value, and the membership number provided as the value
for MEMNUM. The rental number should be provided automatically from the auto increment enabled in the previous problem.
Create a stored procedure named prcnewdetailto insert new rows in the DETAILRENTAL table. The procedure should satisfy the following
requirements:
The video number will be provided as a parameter.
Verify that the video number exists in the VIDEO table. If it does not exist, then display a message that the video does not exist, and do not write
any data to the database.
If the video number does exist, then verify that the VIDSTATUS for the video is IN If the status is not IN then display a message that the
video's return must be entered before it can be rented again, and do not write any data to the database.
If the status is IN then retrieve the values of the video's PRICERENTFEE, PRICEDAILYLATEFEE, and PRICERENTDAYS from the PRICE
table.
Calculate the due date for the video rental by adding the number of days in PRICERENTDAYS to :: PM hours:minutes:seconds in the
current system date.
Insert a new row in the DETAILRENTAL table using the previous value returned by RENTNUMSEQ as the RENTNUM, the video number
provided in the parameter as the VIDNUM, the PRICERENTFEE as the value for DETAILFEE, the due date calculated above for the
DETAILDUEDATE, PRICEDAILYLATEFEE as the value for DETAILDAILYLATEFEE, and null for the DETAILRETURNDATE.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
