Yurttas/PL/DBL/oracle/F/02/Movie/q03.sp

From ZCubes Wiki
Jump to navigation Jump to search
 1/*
 2REM
 3REM q03.sp
 4REM
 5REM Find the name and address of the producer 
 6REM of 'Good Will Hunting' movie.
 7REM
 8*/
 9
10CREATE OR REPLACE
11PROCEDURE q03 IS   
12
13  CURSOR movie_cursor IS
14    SELECT name, address
15    FROM MovieExec, Movie
16    WHERE title = 'Good Will Hunting'
17      AND producercn = cn;
18
19  movie_rec movie_cursor%ROWTYPE;  
20
21BEGIN
22
23  DBMS_OUTPUT.PUT_LINE('Name' || '         ' || 'Address'); 
24
25  OPEN movie_cursor;
26
27  FETCH movie_cursor INTO movie_rec;
28
29  WHILE movie_cursor%FOUND 
30  LOOP
31    DBMS_OUTPUT.PUT_LINE(movie_rec.name || ' ' || movie_rec.address); 
32    FETCH movie_cursor INTO movie_rec;
33  END LOOP;
34
35END q03;
36/