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

From ZCubes Wiki
Jump to navigation Jump to search
 1/*
 2REM
 3REM q02.sp
 4REM
 5REM Find all movies of 1998 ordered by title
 6REM and studios in ascending order grouped 
 7REM by BW and color.
 8REM
 9*/
10
11CREATE OR REPLACE
12PROCEDURE q02 IS   
13
14  CURSOR mv_cursor IS
15    SELECT title, studioname
16    FROM Movie
17    WHERE year = 1998
18    ORDER BY title ASC,
19             studioname ASC;
20
21  mv_rec mv_cursor%ROWTYPE;  
22
23BEGIN   
24
25  DBMS_OUTPUT.PUT_LINE('Title'||'    '||'Studio'); 
26
27  OPEN mv_cursor;
28
29  FETCH mv_cursor INTO mv_rec;       
30
31  WHILE mv_cursor%FOUND 
32  LOOP
33    DBMS_OUTPUT.PUT_LINE(mv_rec.title || '     ' || mv_rec.studioname);    
34    FETCH mv_cursor INTO mv_rec;
35  END LOOP;
36
37END q02;
38/