November 24th, 2003, 04:25 AM
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:
CREATE OR REPLACE PROCEDURE sp_customerinfo(p_customertype IN tblCustomer.Type%TYPE, p_CustomerID OUT tblCustomer.CustomerID%TYPE, p_CustomerDOB OUT tblCustomer.DOB%TYPE)
CURSOR customer_cursor IS
WHERE Type = p_customertype;
FETCH customer_cursor into v_CustomerID;
EXIT WHEN customer_cursor%NOTFOUND;
SELECT CustomerID, DOB
INTO p_CustomerID, p_CustomerDOB
WHERE CustomerID = v_CustomerID;