Lab05_code - spool F\Desktop\DBM405A\lab05_output-Step 1 Creating the First Trigger create or replace trigger RENTING_MOVIE after insert on

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
spool F:\Desktop\DBM405A\lab05_output.txt --Step 1: Creating the First Trigger create or replace trigger RENTING_MOVIE after insert on mm_rental for each row BEGIN update mm_movie set movie_qty=movie_qty-1 where movie_id=:old.movie_id; END RENTING_MOVIE; / --Step 2: Creating the Second Trigger create or replace trigger RETURNING_MOVIE after update on mm_rental for each row BEGIN update mm_movie set movie_qty=movie_qty+1 where movie_id=:old.movie_id; END RETURNING_MOVIE; / --Step 3: Modifying the Package Code create or replace package MM_RENTALS_PKG AS procedure MOVIE_RENTAL_SP ( P_MOVIE_ID NUMBER, P_MEMBER_ID NUMBER, P_PAYMENT_METHODS_ID NUMBER ); procedure MOVIE_RETURN_SP (p_rental_id NUMBER); function MOVIE_STOCK_SF (p_movie_id NUMBER) RETURN VARCHAR2; END MM_RENTALS_PKG; / create or replace package body MM_RENTALS_PKG AS procedure MOVIE_RENTAL_SP ( P_MOVIE_ID NUMBER, P_MEMBER_ID NUMBER, P_PAYMENT_METHODS_ID NUMBER ) AS count_movie_id NUMBER; count_member_id NUMBER; count_payments NUMBER; count_movie_qty NUMBER; UNKNOWN_MOVIE EXCEPTION; UNKNOWN_MEMBER EXCEPTION; UNKNOWN_PAYMENT EXCEPTION; UNAVAILABLE_MOVIE EXCEPTION; BEGIN select count(*) into count_movie_id from mm_movie where movie_id=p_movie_id;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/29/2012 for the course DM DM450 taught by Professor Dm450 during the Spring '11 term at DeVry Long Beach.

Page1 / 4

Lab05_code - spool F\Desktop\DBM405A\lab05_output-Step 1 Creating the First Trigger create or replace trigger RENTING_MOVIE after insert on

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online