RelationalDBDesign RelationalDBDesign


Creating Packages   «Prev 

Making the Package Body - Exercise

Create a package

Objective: Combine two procedures and a function into a package

Exercise scoring

This exercise is worth 30 points. You will receive points for correct syntax of the package and for good documentation explaining your use of parameters and variables.

Background/overview

You are working with the House-O-Pets database and have created a procedure and a function. You have decided that it will be more efficient for all of these objects to be stored and used as a package. Your goal is to take the PL/SQL code that creates the procedure and the function and convert it so that it creates a single package that contains both sub-programs. The function should be a private sub-program within the package.

Download files

Download the package_exercise.sql file from the Resources page for the source code of the procedure and functions to be included in your package.

Instructions

Using the downloaded file and your own text editor, create the two commands needed to generate the package specification and package body. Create your
  1. own name for the package,
  2. procedure,
  3. function,
  4. and all parameters.
Document your code by explaining how you used parameters and variables in the package.

Submitting your exercise

Copy the two SQL commands you have created and your explanations for the parameters and variables you used into the text box shown here. Click Submit button to see the results to you.