Review Questions
1. B
2. D
3. A,D
4. C,D
5. B,D
6. A
7. C
8. D
9. A
10. D
11. The user_objects view can be used to determine all the packages that exist in the database. In the query, use a WHERE clause to select the rows that contain the term 'PACKAGE' in the object type column. Selecting the text column of the user_source view will list all the source code lines in the package. Use a WHERE clause on the name column to select a single package.
12. If there are values referenced continually in the application, storing them in packaged variables will allow the values to only be retrieved once thus saving data retrieval processing. The values in global constructs are persistent for the entire user session.
13. Overloading allows two or more program units in a package to have the same name yet accept a different set of arguments. At times you may have certain functionality that you need to occur but you must handle a variety of different types of data to be supplied to the program unit. In this case, you can write several program units to contain the same code yet accept different arguments. The Oracle server will automatically identify the appropriate copy of the program unit to use based on the arguments provided in the invocation.
14. If you need to share some values or objects across all sessions, a package specification allows this by housing global variables, cursors and types. If the package only consists of global constructs to share and no program units then a package body is not needed.
15. A program unit that exists in a package body but is not declared in the package specification is referred to as a private construct. It is private in that only program units that are included in the same package can call or invoke this program unit.
Advanced Review Questions
1. C
2. D
3. B
4. C
5. B, C
Hands-On Assignments
Assignment 7-1
CREATE OR REPLACE PACKAGE order_info_pkg IS FUNCTION ship_name_pf (p_basket IN