Oracle updating records within same cursor

By extending SQL, PL/SQL offers a unique combination of power and ease of use.

You can manipulate Oracle data flexibly and safely because PL/SQL fully supports all SQL data manipulation statements (except ), transaction control statements, functions, pseudocolumns, and operators.

For additional information on assigning values to PL/SQL variables, see "Assigning a SQL Query Result to a PL/SQL Variable".

Oracle is transaction oriented; that is, Oracle uses transactions to ensure data integrity.

It’s important to know when not to use cursor FOR loops.

My mentor told me that when querying data I should always use a cursor FOR loop, even for a single row lookup. It’s great to learn from others, and it’s especially wonderful when the lesson you learn is simple and easy to remember.

Oracle provides the FOR UPDATE clause in SQL syntax to allow the developer to lock a set of Oracle rows for the duration of a transaction.

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.

It’s rare, in fact, that the data with which you are working is just a single value, so records and other composite datatypes are likely to figure prominently in your PL/SQL programs.

This article explores how you declare records, populate them with rows from a table, and even insert or change an entire row in a table by using a record.

I have a different set of recommendations about cursor FOR loops, which I learned from one of my mentors in the PL/SQL world, Bryn Llewellyn, Oracle’s PL/SQL product manager.

Let’s take a closer look at these five cursor FOR loop recommendations. This advice may come as something of a shock to you.

Leave a Reply