Basic HTML version of Foils prepared 7 October 97

Foil 27 The PL/SQL Package For Phone Example - I

From Untitled presentation ARL Database Tutorial -- February 98. by Gang Cheng, C.W. Ou, Geoffrey C. Fox


CREATE PACKAGE EXAMPLE is procedure get_phoneno_by_name(name IN VARCHAR2); -- only one procedure
END EXAMPLE;
CREATE PACKAGE BODY EXAMPLE IS
  • CREATE PROCEDURE get_phoneno_by_name(name IN VARCHAR2) IS
  • CURSOR person_cur(cname IN VARCHAR2) IS
  • SELECT last_name,first_name,phone_no,phone_type
    • from person_info_table,phone_list_table WHERE
    • (person_info_table.person_id = phone_list_table.person_id) AND
    • (last_name LIKE ('%' || LOWER(cname) || '%' ) OR
    • first_name LIKE ('%' || LOWER(cname) || '%'));
    • lname person_info_table.last_name%TYPE; -- a variable to hold last name
    • fname person_info_table.first_name%TYPE; -- a variable to hold first name
    • phone phone_list_table.phone_no%TYPE; -- a variable to hold phone no.
    • ptype phone_list_table.phone_type%TYPE; -- a variable to hold phone type



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sat Feb 7 1998