What are cursors? Name four types of cursors and when each
one would be applied?

Answer Posted / khushboo rastogi

A cursor is a temporary work area created in the system memory when a SQL statement
is executed. A cursor contains information on a select statement and the rows of data
accessed by it. This temporary work area is used to store the data retrieved from the
database, and manipulate this data. A cursor can hold more than one row, but can process
only one row at a time. The set of rows the cursor holds is called the active set.

There are two types of cursors in PL/SQL:

Implicit cursors:

These are created by default when DML statements like, INSERT, UPDATE, and
DELETE statements are executed. They are also created when a SELECT statement that
returns just one row is executed.

Explicit cursors:

They must be created when you are executing a SELECT statement that returns more
than one row. Even though the cursor stores multiple records, only one record can be
processed at a time, which is called as current row. When you fetch a row the current row
position moves to next row.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to create a new table in a given schema?

840


Can you edit the .rdl code associated with a linked report?

121


Can you name a few encryption mechanisms in sql server?

687


How to insert data into an existing table?

715


What is transaction server explicit transaction?

744






How do I view a stored procedure in sql server query?

699


What are the steps to take to improve performance of a poor performing query? : sql server database administration

784


Can a function call a stored procedure in sql server?

697


Explain the creation and execution of a user-defined function in the sql server?

781


How can you list all the table constraints in a database?

697


How can we rewrite sub-queries into simple select statements or with joins?

704


What is raid and what are different types of raid levels?

776


What do you mean by a Composite primary key?

759


What is trigger explain with program?

706


How to modify the underlying query of an existing view?

744