
November 24th, 2003, 04:25 AM
|
|
Junior Member
|
|
Join Date: Nov 2003
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
PL / SQL Procedure
I have wrote a stored procedure to return details about a customer in my oracle database.
I will then be connecting to it via PHP.... (I have do this but again it only returns the last row)
I have a problem with my procedure - it only returns the last row. If I do a dbms_output.put_line in my loop it returns the correct values. Is there any way to return all the rows?
Here is my code for the procedure:
PHP Code:
CREATE OR REPLACE PROCEDURE sp_customerinfo(p_customertype IN tblCustomer.Type%TYPE, p_CustomerID OUT tblCustomer.CustomerID%TYPE, p_CustomerDOB OUT tblCustomer.DOB%TYPE)
IS
CURSOR customer_cursor IS
SELECT CustomerID
FROM tblCustomer
WHERE Type = p_customertype;
v_CustomerID tblCustomer.CustomerID%TYPE;
BEGIN
OPEN customer_cursor;
LOOP
FETCH customer_cursor into v_CustomerID;
EXIT WHEN customer_cursor%NOTFOUND;
SELECT CustomerID, DOB
INTO p_CustomerID, p_CustomerDOB
FROM tblCustomer
WHERE CustomerID = v_CustomerID;
END LOOP;
CLOSE customer_cursor;
END;
/
Any ideas?
|