After re-reading your question again, I realize I missed your original intent. It appears you want to return a result set based on the first and last name passed to a function/procedure.
This should get you headed in the right direction.
CREATE OR REPLACE PACKAGE pkg_example
AS
type name_query_cursor is ref cursor;
END;
CREATE OR REPLACE PROCEDURE sp_doSomething(in_fname IN VARCHAR,
in_lname IN VARCHAR,
my_cursor IN OUT pkg_example.name_query_cursor)
IS
BEGIN
OPEN my_cursor FOR
SELECT lname,fname,userid
FROM yourTableName
WHERE fname = in_fname AND lname = in_lname;
END;
EDIT: To check/run it, you can do something like:
CREATE OR REPLACE PROCEDURE check_procedure (in_fname IN VARCHAR,
in_lname IN VARCHAR)
AS
v_cur pkg_example.name_query_cursor;
-- This is assuming the 3 columns above are all the columns
-- in the table. If not, either create your own record type
-- in pkg_example, or create three separate vars
-- for each column and FETCH into them
v_row yourTableName%rowtype;
BEGIN
sp_doSomething(in_fname, in_lname, v_cur);
LOOP
FETCH v_cur into v_row;
EXIT when v_cur%NOTFOUND;
dbms_output.put_line ('FName: ' || v_row.fname || ' LName: ' || v_row.lname);
END LOOP;
END check_procedure;
-- Then from your SQL prompt execute the check_procedure
SQL> execute check_procedure ('bob', 'cline')