Expert

5-23.

The following procedure header has a long list of parameters, making it difficult to use (you have to declare many variables, remember the order or names of the parameters, etc.). Rewrite the header to fix this problem.

CREATE OR REPLACE PROCEDURE
insert_lobbyist_contact
(
p_home_area_code_in        VARCHAR2,
p_home_prefix_in           VARCHAR2,
p_home_phone_number_in     VARCHAR2,
p_office_area_code_in      VARCHAR2,
p_office_prefix_in         VARCHAR2,
p_office_phone_number_in   VARCHAR2,
p_cell_area_code_in        VARCHAR2,
p_cell_prefix_in           VARCHAR2,
p_cell_phone_number_in     VARCHAR2,
p_fax_area_code_in         VARCHAR2,
p_fax_prefix_in            VARCHAR2,
p_fax_phone_number_in      VARCHAR2,
p_bath_phone_area_code_in  VARCHAR2,
p_bath_phone_prefix_in     VARCHAR2,
p_bath_phone_number_in     VARCHAR2,
p_bath_fax_area_code_in    VARCHAR2,
p_bath_fax_prefix_in       VARCHAR2,
p_bath_fax_number_in       VARCHAR2
);

5-24.

Why does the following declaration section fail to compile (assume that all database objects are referenced correctly)?

DECLARE
   /*  Table Type - table of employee numbers  */
   TYPE empno_table_type IS TABLE OF emp.empno%TYPE
      INDEX BY BINARY_INTEGER;

   /*
   || Record Type - department information
   || with table of employees
   */
   TYPE dept_rec_type IS RECORD (
      deptno        NUMBER(5),
      dept_name     dept.dname%TYPE,
      total_salary  NUMBER NOT NULL := 0,
      emp_table     empno_table_type
      );

   /*  Table Type - table of departments  */
   TYPE dept_table_type IS TABLE OF dept_rec_type
      INDEX BY BINARY_INTEGER;

5-25.

What is wrong with this code? How would you improve it?

DECLARE CURSOR so_tasty ...

Get Oracle PL/SQL Programming: A Developer's Workbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.