嘿,任何人都可以帮助解决这个错误:
9/10 PLS-00428: an INTO clause is expected in this SELECT statement
尝试根据单个参数打印出细节时出现。这是我一直在使用的代码
CREATE OR REPLACE PROCEDURE PRINT_ACTOR_QUOTES (ID_actor CHAR)
AS
first_name CHAR(30);
last_name CHAR(30);
title CHAR(40);
year NUMBER;
role CHAR(40);
quote CHAR(255);
CURSOR print_cursor IS
SELECT a.actorID, a.firstname, a.lastname, m.title as title, m.year as year ,
r.rolename as role1 , q.quotechar as quote1 FROM movie m, role r, quote q, rolequote
rq, actor a WHERE
a.actorID = r.actorID AND
m.movieID = r.movieID AND
rq.quoteID = q.quoteID AND
rq.roleID = r.roleID;
BEGIN
FOR row IN print_cursor LOOP
SELECT AQ.QUOTES, A.FIRSTNAME, A.LASTNAME
FROM ACTOR_QUOTES AQ, ACTOR A
Where row.actorID = ID_actor;
END LOOP;
END PRINT_ACTOR_QUOTES ;
/
答案 0 :(得分:1)
我假设相关错误是
PLS-00428:此SELECT语句中需要一个INTO子句
(而不是你在问题标题中提到的那个)。
问题是FOR循环中的SELECT语句。在PL / SQL中,您不能只选择数据而不做任何事情。因此,您需要一个INTO语句将检索到的数据存储在PL / SQL变量中:
SELECT AQ.QUOTES, A.FIRSTNAME, A.LASTNAME
INTO quote, first_name, last_name
FROM ACTOR_QUOTES AQ, ACTOR A
Where row.actorID = ID_actor;
然后我可以发现其他几个问题: