title: Print Quotes from nested table
body: <p>Trying to complete following: </p>
  
  <pre><code>    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;
  /
  </code></pre>
  
  <p>Create A PL/SQL PROCEDURE called PRINT_ACTOR_QUOTES (by modifying the procedure  POPULATE_ACTOR_QUOTES) with a single parameter that: Prints out the firstname and lastname attributes corresponding to the ACTORID (ACTORID is the procedure parameter) from the ACTOR table as well printing out all the quote information from the nested QUOTES table </p>
  
  <p>This is what I have created:</p>
  
  <pre><code>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;
  / 
  </code></pre>
  
  <p>The output</p>
  
  <pre><code>SQL&gt; EXECUTE PRINT_ACTOR_QUOTES ('00070')
  
  Dustin                   Hoffman
  </code></pre>
  
  <p>need to create an output which looks like:</p>
  
  <p>JEFF GOLDBLUM</p>
  
  <pre><code>|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”           |
  </code></pre>
  
  <p>I have the first name and second name - need the information from the the nested QUOTES table</p>
  
  <p>Help needed!</p>
  
  <p>I have got the following select query which brings up the needed information from the nested quotes- just need to add it to the -- PROCEDURE PRINT_ACTOR_QUOTES</p>
  
  <pre><code>SELECT REC.*
    FROM ACTOR_QUOTES A,TABLE(A.QUOTES) REC
    WHERE ACTORID = ('00070')
  </code></pre>