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!
|