Type: Instant Download
Format: Notepad
Version: Current 2013-14 (Click on tutorial image to view snapshot)
Frequently Asked Questions
What is included in the full course package? The entire course study guide includes the output file homework solution in notepad for DBM 405 Lab 3: Procedures and Functions (bachelors program)
Your tutorial will include these files:
What if I find a question is missing? Just shoot us an email or contact us via live chat. Our expert DBM tutors will add the answers to the study guide within 1 to 3 days. You will receive a free update to the study guide with the answers you need.
Will this help me with DBM 405 problems? Yes, this guide is designed to help students get through the DBM 405 Lab 3 exercise with ease.
|
Step 1: Creating the First Procedure |
Your first procedure is to be named MOVIE_RENTAL_SP and is going to provide functionality to process movie rentals. Based on data that will represent the movie ID, member ID, and payment method your procedure will need to generate a rental ID and then insert a new row of data into the mm_rental table. The process will also need to update the quantity column in the mm_movie table to reflect that there is one less copy of the rented movie in stock. Along with the processing, you will also need to define some user-defined exception handlers that will be used in validating the input data. Since you may need to recreate your procedure several times during the debugging process, it is suggested that you use the CREATE OR REPLACE syntax at the beginning of the CREATE statement.
The following steps will help you in setting up your code.
Compile and check your code. If you get a PROCEDURE CREATED WITH COMPILATION ERRORS message then type in SHOW ERRORS and look in your code for the line noted in the error messages (be sure to compile your code with the session command SET ECHO ON). Once you have a clean compile then your are ready to test.
|
Step 2: Testing the First Procedure |
You will need to test for scenarios that will allow both a clean movie rental and test each exception. This means that you will need to run at least five test cases. One each for the following:
Your output from the testing should look similar to (this would be the output for the first test above):
exec movie_rent_sp(13, 10, 2);
Output:
There is no movie with id: 13
Cannot proceed with rental
PL/SQL procedure successfully completed.
Be sure that when you have verified that everything works, you run your testing in a spools session and save the file to be turned in.
|
Step 3: Creating the Second Procedure |
Your second procedure should be named MOVIE_RETURN_SP and should facilitate the process of checking a movie rental back in. For this procedure, you will only need to pass one piece of data to the procedure; the rental ID. You will need two user-defined exceptions; one for no rental record and one for already returned. You will be able to use several of the same techniques you used in the first procedure for your validation.
The following steps will help in setting up your code.
Compile and check your code. If you get a PROCEDURE CREATED WITH COMPILATION ERRORS message then type in SHOW ERRORS and look in your code for the line noted in the error messages (be sure to compile your code with the session command SET ECHO ON). Once you have a clean compile then your are ready to test.
|
Step 4: Testing the Second Procedure |
You will need to test for scenarios that will allow both a clean rental return and test each exception. This means that you will need to run at least three test cases. One each for the following:
You output from the testing should look similar to (this would be the output for the first test above):
exec movie_return_sp(20);
Output:
There is no rental record with id: 20
Cannot proceed with return
PL/SQL procedure successfully completed.
Be sure that when you have verified that everything works, you run your testing in a spools session and save the file to be turned in.
|
Step 5: Creating the Function |
Your function should be named MOVIE_STOCK_SF and will be used to return a message telling the user whether a movie title is available or not based on the movie ID passed to the function. The exception handling that will be needed is for NO_DATA_FOUND but we are going to set it up as a RAISE_APPLICATION_ERROR.
The following steps will help in setting up your code.
Compile and check your code. If you get a FUNCTION CREATED WITH COMPILATION ERRORS message then type in SHOW ERRORS and look in your code for the line noted in the error messages (be sure to compile your code with the session command SET ECHO ON). Once you have a clean compile then your are ready to test.
|
Step 6: Testing the Function |
You will need to test for all three possible scenarios.
For test number 2, you may need to manipulate the quantity amount in the database, which will be fine.
Test your function by using a select statement against the DUAL table like in the example below:
select movie_stock_sf(20) from dual;
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more