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


1 A stored procedure to query the phone-list database by a person's last or first name may look like this:
2 CREATE PROCEDURE get_phoneno_by_name
3 (name IN VARCHAR2) IS
4 CURSOR person_cur(cname IN VARCHAR2) IS
5 SELECT last_name,first_name,phone_no,phone_type
6 from person_info_table,phone_list_table
7 WHERE (person_info_table.person_id =
  • phone_list_table.person_id)
8 AND ( last_name LIKE ('%' || LOWER(cname) || '%')
9 OR first_name LIKE ('%' || LOWER(cname) || '%'));
10 Note that above we have SQL not PL/SQL and variables are column names from database
11 Argument cname of CURSOR will be supplied when we invoke later!

in Table To:


© 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