Updating table while open cursor

11-Jul-2016 22:53

Oracle is transaction oriented; that is, Oracle uses transactions to ensure data integrity.I have highlighted the areas which differ compared with a normal cursor.By extending SQL, PL/SQL offers a unique combination of power and ease of use.There can be a situation where you have to use a cursor, even though the experts say not to use cursors or to avoid them as much as possible.But if you look closely, most of the time we use cursors to iterate through a row collection and update the same table.In addition to static SQL discussed in this chapter, PL/SQL also supports dynamic SQL, which enables you to execute SQL data definition, data control, and session control statements dynamically.See Chapter 7, "Performing SQL Operations with Native Dynamic SQL".In these type of situations, it is ideal to use a Update Cursor, than using the default read only one.

For information on the use of PL/SQL records with SQL to update and insert data, see "Inserting PL/SQL Records into the Database" and "Updating the Database with PL/SQL Record Values".For additional information on assigning values to PL/SQL variables, see "Assigning a SQL Query Result to a PL/SQL Variable".

This are the best free chat rooms currently online.… continue reading »

Read more