1
--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> 显示错误 PROCEDURE MOVIE_RENTAL_SP 的错误:

LINE/COL 错误


7/1 PL/SQL:SQL 语句被忽略 9/2 PL/SQL:ORA-00947:没有足够的值

4

2 回答 2

0

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

于 2013-03-27T05:05:41.697 回答
0

将选择语句更改为,

SELECT MOVIE_ID, count(movie_id)
INTO movieID , movieIdCount
.....
于 2013-03-28T02:11:28.270 回答