Basic HTML version of Foils prepared 7 October 97

Foil 40 An Example in OraPerl - Query a Person's Phone Number By Last or First Name - I

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


#!/usr/local/bin/oraperl
# Specify the user name/password and a database server
$user_name = "cps616"; $passwd = "xyz"; $database = $ENV{'ORACLE_SID'};
# Login to the ORACLE SQL.
$lda = &ora_login($database, $user_name, $passwd) || die; $ora_errstr;
# Cursor for quering phone number by a person's first or last name
$phone_cursor =
"SELECT last_name, first_name, phone_no, phone_type
FROM person_info_table a, phone_list_table b
WHERE (last_name LIKE ('%' || LOWER(:1) || '%') OR
    • first_name LIKE ('%' || LOWER(:1) || '%'))
AND (a.person_id = b.person_id)";



© 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