完成以下工作:
CREATE OR REPLACE
PROCEDURE POPULATE_ACTOR_QUOTES (id_actor char)
AS
CURSOR quote_recs IS
SELECT m.title,
m.year,
r.roleName,
q.quotechar
from quote q,
role r,
rolequote rq,
actor a,
movie m
where rq.quoteID = q.quoteID
AND rq.roleID = r.roleID
AND r.actorID = a.actorID
AND r.movieID = m.movieID
AND a.actorID = id_actor;
BEGIN
FOR row IN quote_recs
LOOP
INSERT INTO table(
SELECT quotes
FROM actor_quotes aq
WHERE aq.actorId = id_actor)
VALUES(
ACTOR_QUOTE_TYPE(row.title, row.year, row.roleName, row.quotechar)
);
end loop;
END POPULATE_ACTOR_QUOTES;
/
创立一个称为PRINT_ACTOR_QUOTES (通过修改程序POTE_ACTOR_QUOTES)的单一参数: 印刷ACTOR表格中与ACTORID(程序参数)对应的第一份名称和最后名称属性,并印刷从表格中引述的所有信息。
这是我创造的:
CREATE OR REPLACE PROCEDURE PRINT_ACTOR_QUOTES (id_actor char)
AS
CURSOR quote_recs IS
SELECT a.firstName,a.lastName, m.title, m.year, r.roleName ,q.quotechar from quote q, role r,
rolequote rq, actor a, movie m
where
rq.quoteID = q.quoteID
AND
rq.roleID = r.roleID
AND
r.actorID = a.actorID
AND
r.movieID = m.movieID
AND
a.actorID = id_actor;
BEGIN
FOR row IN quote_recs
LOOP
DBMS_OUTPUT.PUT_LINE( row.firstName || || row.lastName );
END LOOP;
END PRINT_ACTOR_QUOTES;
/
产出
SQL> EXECUTE PRINT_ACTOR_QUOTES ( 00070 )
Dustin Hoffman
有必要创造出一种着眼于以下方面的产出:
JEFF GOLDBLUM
|Title | Year | Role | Quote |
----------------------------------------------------------------------------------------------
|THE FLY |1986 |SETH BRUNDLE | “I’m free and you don’t like it’’ |
|INDEPENDENCE DAY| 1996 | DAVID LEVINSON | “I’ve given it a virus” |
我有第一个名字和第二个名字——需要从封顶的QUOTES表获得的信息。
需要帮助!
下面是引出从引证的引言中得出的所需信息,即:
SELECT REC.*
FROM ACTOR_QUOTES A,TABLE(A.QUOTES) REC
WHERE ACTORID = ( 00070 )