Where would you use implicit & explicit cursors?

Showing Answers 1 - 0 of 0 Answers

harru

  • Dec 12th, 2011
 

If select query is retrieving less than 200 records go for implicit cursor.

Code
  1.  

  2. begin

  3. for i in (select * from emp)

  4. ----------------

  5. end


Else use explicit cursor

Code
  1. declare

  2. cursor c1 is select * from emp_morethan200

  3. begin

  4. for i in c1 loop

  5. ----------------

rayavarapu

  • Jan 23rd, 2013
 

Implicit Cursor:- It is Oracle pre-defined type.. when we fetch only one record then we need to use implicit cursor.

Explicit cursor:- It is user defined cursor.. when we need to fetch more the one records we need to use explicit cursor..

anonymous

  • Apr 4th, 2013
 

An implicit cursor is one created "automatically" for you by Oracle when you execute a query. It is simpler to code, but suffers from

inefficiency (the ANSI standard specifies that it must fetch twice to check if there is more than one record)
vulnerability to data errors (if you ever get two rows, it raises a TOO_MANY_ROWS exception)
Example

SELECT col INTO var FROM table WHERE something;
An explicit cursor is one you create yourself. It takes more code, but gives more control - for example, you can just open-fetch-close if you only want the first record and dont care if there are others.

Example

DECLARE
CURSOR cur IS SELECT col FROM table WHERE something;
BEGIN
OPEN cur;
FETCH cur INTO var;
CLOSE cur;
END;

  Was this answer useful?  Yes

hira

  • Aug 8th, 2013
 

When ever any query execute by the server in database sever itself create a implicit cursor ,which can not any control to the programmer but in case explicit cursor the programmer has to create it.and used for the data manipulation by following some rule......

  Was this answer useful?  Yes

Malar somu

  • Sep 10th, 2013
 

Implicit Cursor:- It is Oracle implicit type.. when we fetch only one record then we need to use implicit cursor i.e when ever we performing select query or any dml operations termed as implicit cursor.can perform with only one record cant do it with multiple records.

Explicit cursor:- It is user defined cursor.. when we need to fetch more the one records we need to use explicit cursor..

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Answer Question

Click here to Login / Register your free account


 
Send   Reset

 

Related Answered Questions

 

Related Open Questions