Do the following exercises:
Write a PL/SQL procedure that receives two movie IDs and an integer amount and “transfers” a given amount of rank value from a source movie to a destination movie. Note that this doesn’t make much sense in the context of the movie database, but it’s similar to money transfers in a banking database.
Your procedure should be designed in such a way that it can be run simultaneously by the following sample script to separate threads and still give a consistent result.
BEGIN FOR i IN 1..10000 LOOP transferRank(176712, 176711, 0.1); COMMIT; transferRank(176711, 176712, 0.1); COMMIT; END LOOP; END;
This script moves rank points between two movies (Kill Bill 1 and Kill Bill 2). Note the following.
CREATE OR REPLACE PROCEDURE yourProcedure my_exception EXCEPTION; BEGIN ...some code... RAISE my_exception; ...some more code... EXCEPTION WHEN my_exception THEN ...error handling code for your exception... WHEN my_other_exception THEN ...error handling code for my_other_exception(s)... END;
Store your solution in homework10.sql
.
Complete the programming elements for the lab exercises.
We will grade your work according to the following criteria: