Chapter 9 Test Your Thinking

In this chapter, you learned how to process data with a cursor. Additionally, you learned how to simplify the code by using a cursor FOR loop. You also encountered the more complex example of nesting cursors within cursors.

1) Write a nested cursor where the parent cursor calls information about each section of a course. The child cursor counts the enrollment. The only output is one line for each course with the Course Name and Section Number and the total enrollment.
2) Write an anonymous PL/SQL block that finds all the courses that have at least one section that is at its maximum enrollment. If there are no courses that meet that criterion, then pick two courses and create that situation for each.
  1. For each of those ...

Get Oracle® PL/SQL® Interactive Workbook, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.