尝试完成以下内容:
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 的 PL/SQL PROCEDURE(通过修改过程 POPULATE_ACTOR_QUOTES),其参数如下: 从 ACTOR 表中打印出对应于 ACTORID(ACTORID 是过程参数)的名字和姓氏属性,并打印出所有报价来自嵌套 QUOTES 表的信息
这是我创建的:
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
需要创建一个如下所示的输出:
杰夫·戈德布鲁姆
|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 表中的信息
需要帮助!
我有以下选择查询,它从嵌套引号中调出所需的信息-只需将其添加到 -- PROCEDURE PRINT_ACTOR_QUOTES
SELECT REC.*
FROM ACTOR_QUOTES A,TABLE(A.QUOTES) REC
WHERE ACTORID = ('00070')