Updating using explicit cursors

Rated 3.86/5 based on 506 customer reviews

The caller of the function can process the result set based on the cursor reference.

The following diagram illustrates how to use a cursor in Postgre SQL: We will examine each step in more detail in the following sections.

Summary: in this tutorial, we will show you how to use PL/pg SQL Cursor and give you some practical examples of using cursors.

A PL/pg SQL cursor allows us to encapsulate a query and process each individual row at a time.

Thus, only SQL SELECT statements must be used as the cursor associated statements and not others. For complete notes on programming in PL/SQL, we recommend the book Advanced PL/SQL: The Definitive Reference by Boobal Ganesan.

This is a complete book on PL/SQL with everything you need to know to write efficient and complex PL/SQL code.

Each PL/SQL program consists of SQL and PL/SQL statements which form a PL/SQL block.

A PL/SQL Block consists of three sections: Declaration Section: This section is optional and it starts with the reserved keyword DECLARE.

updating using explicit cursors-6

updating using explicit cursors-78

updating using explicit cursors-74

This is an efficient way to return a large result set from a function.

PL/SQL stands for Procedural Language extension of SQL.

It is a combination of SQL along with the procedural features of programming languages and it enhances the capabilities of SQL by injecting the procedural functionality, like conditional or looping statements, into the set-oriented SQL structure.

Rather than executing a whole query at once, it is possible to set up a cursor that encapsulates the query, and then read the query result a few rows at a time.

One reason for doing this is to avoid memory overrun when the result contains a large number of rows.

Leave a Reply

  1. Sex chat on skype philippines 31-Jan-2018 10:31

    Incorrect credential cached in Credential Manager Your Windows system stores user credentials on your computer.