Plsql updating in cursor
I'll take a closer look at each option and explain why it's difficult to pinpoint which is better in terms of performance.Cursors are a looping construct built inside the database engine and come with a wide variety of features.There are situations in which you need to individually handle each row in a result set.SQL Server 2008 provides a minimal set of tools — cursors and WHILE loops — to accomplish this task.What I love about writing SQL Tuning articles is that I very rarely end up publishing the findings I set out to achieve. We have a table containing years worth of data, most of which is static; we are updating selected rows that were recently inserted and are still volatile. For the purposes of the test, we will assume that the target table of the update is arbitrarily large, and we want to avoid things like full-scans and index rebuilds.
*/ EXCEPTION /* Exception handling section: error handling statements go here. The executable section also contains constructs such as assignments, branches, loops, procedure calls, and triggers, which are all described below (except triggers). C style comments ( or by putting the code in a file and invoking the file in the various ways we learned in Getting Started With Oracle.
2) Accessing the records in the cursor: Once the cursor is created in the declaration section we can access the cursor in the execution section of the PL/SQL program. If you want to fetch after the last row, the program will throw an error.
When there is more than one row in a cursor we can use loops along with explicit cursor attributes to fetch all the records.
Information is transmitted between a PL/SQL program and the database through variables. In many cases, a PL/SQL variable will be used to manipulate data stored in a existing relation.
Every variable has a specific type associated with it. In this case, it is essential that the variable have the same type as the relation column.