PL / SQL语句被忽略&价值不够

时间:2013-03-27 04:58:47

标签: plsql procedures

--Below is for testing only - to be deleted later
CREATE OR REPLACE PROCEDURE movie_rental_sp 
    (movieIdCount IN OUT NUMBER,
    movieID IN OUT NUMBER)
IS
noMovie EXCEPTION;
BEGIN
SELECT MOVIE_ID, count(movie_id)
    INTO movieIdCount
    FROM MM_MOVIE
    WHERE MOVIE_ID = movieID;
IF movieIdCount = 0 THEN
RAISE noMovie;
END IF;


EXCEPTION
    WHEN noMovie THEN
    DBMS_OUTPUT.PUT_LINE('No movies found');
END;
/

警告:使用编译错误创建过程。

SQL>显示错误 程序错误MOVIE_RENTAL_SP:

LINE / COL ERROR


7/1 PL / SQL:忽略SQL语句 9/2 PL / SQL:ORA-00947:值不够

2 个答案:

答案 0 :(得分:0)

您的SELECT有2列,但您的INTO只有1个变量。

答案 1 :(得分:0)

将select语句更改为,

SELECT MOVIE_ID, count(movie_id)
INTO movieID , movieIdCount
.....