0

所以我刚刚为我的表创建了这个触发器:

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;
/

我现在想通过使用类似的查询来取消表QUOTES的任何嵌套,该查询取消嵌套表并列出其中的所有四个数据项。ACTORIDQUOTES

这是原始表模式

CREATE TABLE ACTOR_QUOTES (
   ACTORID CHAR(5),
   QUOTES  AQ_NT
)  
NESTED TABLE QUOTES STORE AS ACTOR_QUOTES_NT
/
4

1 回答 1

1

您可以使用 TABLE 函数执行相同的操作

  SELECT REC.*

  FROM ACTOR_QUOTES A,TABLE(A.QUOTES) REC

供参考,请检查

http://psoug.org/reference/nested_tab.html

于 2012-05-01T12:13:25.817 回答