O'Reilly logo

DB2® SQL PL: Essential Guide for DB2® UDB on Linux™, UNIX®, Windows®, i5/OS™, and z/OS®, Second Edition by Paul Yip, Fraser McArthur, Michael Gao, Raul Chong, Drew Bradstock, Clara Liu, Zamil Janmohamed

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 5. Understanding and Using Cursors and Result Sets

In this chapter, you will learn

  • What a cursor is

  • How to use cursors inside SQL procedures

  • How to perform positioned deletes and positioned updates

  • How cursors affect locking

  • About cursor behavior on commit and rollback

  • How to use nested save points

  • How cursors are used to return result sets to applications.

In previous chapters, you have seen how SQL procedures can manipulate table data by directly executing INSERT, UPDATE, and DELETE statements. Using SQL in this manner, however, means that operations must be applied to the entire set of data defined by the WHERE clause of the statement. In SQL procedures, it is possible to define a set of data rows (which will be called a result set from here ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required