i am trying to create a sql function that prints the reservations made by a customer when his name is beeing given. The customers names are in a table called CLIENTS.FNAME CLIENTS.MNAME CLIENTS.LNAME and the reservations searched by an id- foreign key there is the code for the function that shows a 'too many values" error, maybe it has to be done by Loop or something?
create or replace FUNCTION cl_reserv(clName VARCHAR2)
RETURN RESERVATIONS%ROWTYPE
IS
resRecord RESERVATIONS%ROWTYPE;
BEGIN
SELECT RESID,STARTDATE,ENDDATE,ADDINFO INTO resRecord
FROM RESERVATIONS INNER JOIN CLIENTS ON RESERVATIONS.CLIENTID=CLIENTS.CLIENTID
WHERE clName IN (FNAME,MNAME,LNAME);
RETURN resRecord;
END;