RelationalDBDesign RelationalDBDesign


Creating Triggers  «Prev  Next»

Creating Trigger Combination - Exercise

Creating a combination insert, update, and delete trigger

Objective: Create one trigger that combines the three triggers from the previous exercise

Exercise scoring

This exercise is worth 15 points. Once you have completed your answer you will submit it.

Background/overview

This exercise works with the Pet Store schema (our course project) and tests your new skills in using Oracle exclusive operators and conditions and your ability to create a hierarchical query. Now that you have created three triggers for the PET_CARE_LOG table in the previous lesson, you want to combine all three triggers so that they can share the exception handler and other code if possible.

Download files

Download the PETSTORE schema files from the Resources page if you plan to install them into your own database.

Hints

Look at the simulation in this lesson to see how to change the exception handler code so that it can send different messages.

Instructions

Create one trigger that fires whenever an insert, update, or delete occurs on the PET_CARE_LOG. Divide up the body into sections that are executed only when an insert occurs, only when an update occurs, and only when a delete occurs.

Submitting your exercise

Create the code on your computer. Then cut and paste the text of the entire trigger into the text box below. Click the Submit button to submit your answers.
Remember that you must submit all your responses to this exercise at once.