Explain the two type of Cursors ?

Answers were Sorted based on User's Feedback



Explain the two type of Cursors ?..

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

Explain the two type of Cursors ?..

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

Explain the two type of Cursors ?..

Answer / kotravel. b

1 inpilicite cursors
2 expilicite cursors

Is This Answer Correct ?    9 Yes 2 No

Explain the two type of Cursors ?..

Answer / gireesh.p.v

Implict Cursor and Explicit
Cursor.



& also REF CURSORS

Is This Answer Correct ?    8 Yes 2 No

Explain the two type of Cursors ?..

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

Explain the two type of Cursors ?..

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

Explain the two type of Cursors ?..

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

Explain the two type of Cursors ?..

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

Post New Answer

More SQL PLSQL Interview Questions

What is minus?

0 Answers  


how would you enter characters as hex numbers? : Sql dba

0 Answers  


How do I run a sql query in pgadmin 4?

0 Answers  


How to run pl/sql statements in sql*plus?

0 Answers  


I have a CURSOR then why we need BULK COLLECT again?

1 Answers  






What is the use of index in sql?

0 Answers  


What is the usage of NVL?

7 Answers   Infosys, Micro Infotek,


what are the limitations of identity column? : Transact sql

0 Answers  


What is data definition language?

0 Answers  


how to insert values like 10:10:00,30:25:00 etc.into table after insert how can i sum the above insert values to get the result as 40:35:00

3 Answers  


HOW TO PRINT * ** *** **** ***** BY USING SQL QUERY? (MAY BE USING SCRIPT)

8 Answers   BeBo Technologies,


Determine if oracle date is on a weekend?

0 Answers  


Categories