我有以下代码将标题添加到客户的电影列表或队列中。请告诉我,我做错了什么/不做这件事。
CREATE OR REPLACE PROCEDURE add_movie_queue
(MEMBERID_arg IN NUMBER,
DVDTITLE_arg IN VARCHAR2,
DATEADDEDINQUEUE_arg IN DATE,
QUEUEPOSITION_arg IN INTEGER)
IS
next_movie INTEGER;
current_month INTEGER;
BEGIN
SELECT COUNT(*) INTO current_month FROM RENTAL
WHERE MEMBERID = MEMBERID_arg AND RENTALRETURNEDDATE IS NULL;
SELECT DVDID INTO next_movie FROM RENTALQUEUE
WHERE RENTALQUEUE.MEMBERID = MEMBERID_arg
AND DATEADDEDINQUEUE_arg = (SELECT MIN(DATEADDEDINQUEUE) FROM RENTALQUEUE
WHERE MEMBERID = MEMBERID_arg);
INSERT INTO RENTALQUEUE(MEMBERID,DVDID,DATEADDEDINQUEUE,QUEUEPOSITION)
VALUES(MEMBERID_arg,next_movie,DATEADDEDINQUEUE_arg,QUEUEPOSITION_arg);
END;