Updating records using cursors

Rated 4.29/5 based on 507 customer reviews

That allows us to perform operations on every record on a one-by-one basis.The DECLARE statement declares a cursor and associates it with a SELECT statement that retrieves the rows to be traversed by the cursor.In positional notation, all arguments are specified in order.In named notation, each argument's name is specified using to separate it from the argument expression.Cursors enable manipulation of whole result sets at once.In this scenario, a cursor enables the rows in a result set to be processed sequentially.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.

If one of these conditions occurs, the specified statement executes.

Tables are made up of rows of data, each consisting of one or more columns, so it stands to reason that Oracle Database would make it as easy as possible to work with those rows of data inside a PL/SQL program.

And it does precisely that through its implementation of the datatype, such as a number or string.

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