Home » SQL & PL/SQL » SQL & PL/SQL » HELP PLEASE!
HELP PLEASE! [message #36704] Thu, 13 December 2001 10:31 Go to next message
kimberly
Messages: 6
Registered: December 2001
Junior Member
What does it mean when I get the error "wrong number or types of arguments in call to C_ROOMS"? The error occurs at line 1

DECLARE
V_ID ROOMS.ROOM_ID%TYPE;
V_SEATS ROOMS.NUMBER_SEATS%TYPE;
V_NUM ROOMS.ROOM_NUMBER%TYPE;
CURSOR C_ROOMS(P_SEATS IN ROOMS.NUMBER_SEATS%TYPE) IS
SELECT V_ID, V_NUM, V_SEATS
FROM ROOMS
WHERE NUMBER_SEATS >= 50;
BEGIN
OPEN C_ROOMS;
LOOP
FETCH C_ROOMS INTO V_ID, V_SEATS, V_NUM;
IF C_ROOMS%FOUND THEN
DBMS_OUTPUT.PUT_LINE('THE ROOMS AVAILABLE ARE' || TO_CHAR(C_ROOMS%ROWCOUNT) || ','|| V_ID || ','|| V_NUM ||','|| V_SEATS);
ELSE
DBMS_OUTPUT.PUT_LINE ('NO ROOMS AVAILABLE');
END IF;
END LOOP;
CLOSE C_ROOMS;
COMMIT;
END;
/

----------------------------------------------------------------------
Re: HELP PLEASE! [message #36705 is a reply to message #36704] Thu, 13 December 2001 10:38 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
The C_ROOMS cursor has an input parameter (p_seats) that is not being provided when opened.

open c_rooms(50);


Also, the select statement in the cursor is returning variables, not the column values. I would think you would want it to look something like:

select room_id, room_number, number_seats
  from rooms
 where number_of_seats >= p_seats;


----------------------------------------------------------------------
Re: HELP PLEASE! [message #36730 is a reply to message #36704] Fri, 14 December 2001 08:42 Go to previous message
Frank Kings
Messages: 5
Registered: December 2001
Junior Member
Todd is correct about you fetching variables in your cursor. Your cursor should be selecting the values that are in the table you are querying from. Your fetch into is what provides the value from your table into the variable. That is why you receive that specific error.

----------------------------------------------------------------------
Previous Topic: pl/sql-urgent
Next Topic: Updating a LONG Column
Goto Forum:
  


Current Time: Thu Aug 06 09:07:15 CDT 2020