Explain the two type of Cursors ?
Answers were Sorted based on User's Feedback
Answer / joseph p v
2 Types
-Implicit Cursor
-Explicit Cursor
-Implicit Cursor
All select queries are examples of implicit cursor. While
submitting a select query , Oracle internally handle the
Open, fetch and close operations. Implicit Cursors are
using while query returns only row.
-Explicit Cursor
We want to explicitly define one cursor, open the cursor,
fetch and close the same. These type cursors are using
while the query return more than one row.
Ref Cursors are Cursors having the dynamic cursor statement
capabilities.
Is This Answer Correct ? | 17 Yes | 0 No |
Answer / tulsi
There are two types of cursors, Implict Cursor and Explicit
Cursor.
PL/SQL uses Implict Cursors for queries.
User defined cursors are called Explicit Cursors. They can
be declared and used.
Is This Answer Correct ? | 15 Yes | 2 No |
Answer / gireesh.p.v
Implict Cursor and Explicit
Cursor.
& also REF CURSORS
Is This Answer Correct ? | 8 Yes | 2 No |
Answer / sachin fulari
Brief about Cursors
-------------------
Every SQL statement executed by Oracle has a Private SQL
area that contains info about SQL statement and the set of
data returned.
In PL/SQL, a cursor is a name assigned to a specific
private SQL area of a specific SQL Statement.
There can be either, Static Cursor whose SQL statements is
determined at compile time, or Dynamic Cursor, whose SQL
statement is determined at runtime.
Note: Dynamic Cursors are implemented using Oracle built in
package DBMS_SQL.
Implicit Cursors:
----------------
Any SQL statement that is executed directly or in an PL/SQL
block i.e. execution section or in exception section,
during which it is associated with a work area in memory of
oracle (SGA). This is done using implicit cursor by Oracle.
We do not need to declare implicit cursor hence not be
opened, fetched and closed.
Explicit Cursors:
-----------------
They are the SELECT statement that is declared explicitly
in the declaration section of current block or in a package
specification.
Further we can use open, fetch and close in execution
section or exception section of the block or program to
utilize declared cursor.
To use an explicit cursor we need to declare it in
declaration section of block or package specification.
There are three sub types of explicit cursors:
* Simple Cursor (without parameter)
CURSOR emp_cur IS
SELECT emp_id
FROM emp;
* Parameterized Cursor - That accepts arguments
CURSOR emp_cur (dept_in [IN] NUMBER) IS
SELECT emp_id
FROM emp
WHERE dept = dept_in ;
* Returning Cursor - A cursor header that contains
a return clause
CURSOR emp_cur (dept_in [IN] NUMBER) IS
RETURN emp%ROWTYPE
SELECT *
FROM emp;
Hope so, above paragraphs explain cursors very well and in
details.
Is This Answer Correct ? | 6 Yes | 0 No |
Answer / k minty
actually there are three types of cursors
1. static cursors which are further classified as implicit
cursors and explicit cursors
2. Dynamic Cursors
3. Reference Cursors.
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / sachin fulari
To add upon
-----------
REF CURSOR is data type in Oracle, and to mention it as
dynamic cursor is totally erroneous.
We can declare variables of type REF CURSOR in declartion
section and which later on can associate with different
queries in execution section.
Moreover, we can also pass query as argument to procedures
using such data type.
( To easily understand REF CURSOR data type:
Visualize as if we are declaring a scalar data type like
NUMBER or CHAR and then utilizing it in execution
section.)
Is This Answer Correct ? | 0 Yes | 2 No |
Answer / james bond
<html>
<body>
<h1>Please give detail info</h1>
<p>on cursors.</p>
</body>
</html>
Is This Answer Correct ? | 1 Yes | 5 No |
Explain what is sql?
Why stored procedures are faster than query?
four procedures is are there should i write their in a package
Which is the best place to learn hadoop?
How many types of indexes are there in sql?
what command is used to create a table by copying the structure of another table including constraints ?
Is sql harder than python?
how to create a database in oracle?
What is primary and foreign key?
Does sql*plus also have a pl/sql engine?
What version is sql?
Does google use sql?