Basic HTML version of Foils prepared 7 October 97

Foil 32 An Example of PL/SQL Stored Procedure - I

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


A stored procedure to query the phone-list database by a person's last or first name may look like this:
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) || '%'));
Note that above we have SQL not PL/SQL and variables are column names from database
Argument cname of CURSOR will be supplied when we invoke later!



© 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 Thu Feb 5 1998