top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

Explain Implicit and Explicit cursors.

+1 vote
Explain Implicit and Explicit cursors.
posted Nov 12, 2014 by Vidhya Sagar

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote
Best answer

Oracle automatically declares an implicit cursor every time a SQL statement is
executed. The user is unaware of this and cannot control or process the
information in an implicit cursor.

The program defines an explicit cursor for any query that returns more than one
row of data. This means that the programmer has declared the cursor within the
PL/SQL code block. This declaration allows the application to sequentially
process each row of data as the cursor returns it.

answer Nov 13, 2014 by Arun Gowda
0 votes

Implicit Cursors
PL/SQL issues an implicit cursor whenever you execute a SQL statement directly in your code, as long as that code does not employ an explicit cursor. It is called an "implicit" cursor because you, the developer, do not explicitly declare a cursor for the SQL statement.
If you use an implicit cursor, Oracle performs the open, fetches, and close for you automatically; these actions are outside of your programmatic control.
PL/SQL employs an implicit cursor for each UPDATE, DELETE, or INSERT statement you execute in a program. You cannot, in other words, execute these statements within an explicit cursor, even if you want to.

Explicit Cursors
An explicit cursor is a SELECT statement that is explicitly defined in the declaration section of your code and, in the process, assigned a name. There is no such thing as an explicit cursor for UPDATE, DELETE, and INSERT statements.
With explicit cursors, you have complete control over how to access information in the database. You decide when to OPEN the cursor, when to FETCH records from the cursor (and therefore from the table or tables in the SELECT statement of the cursor) how many records to fetch, and when to CLOSE the cursor.

answer Nov 13, 2014 by Manikandan J
Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.