Home » SQL & PL/SQL » SQL & PL/SQL » help me on CURSOR
help me on CURSOR [message #429612] Wed, 04 November 2009 14:19 Go to next message
Messages: 2
Registered: November 2009
Location: india
Junior Member
Can anyone help me in understanding how many times the select statement will be executed in below program?

What exactly the cursor c1 holds? data set returned by select statement or the parsed select statement?

If it holds the parsed select statement then the parsed statement is going to be executed each time we fetch from cursor c1?

v_ename varchar2(30);
cursor c1 is select ename from emp;
open c1;
    fetch c1 into v_ename;
    exit when c1%notfound;
  end loop;
close c1;

[Updated on: Wed, 04 November 2009 14:29]

Report message to a moderator

Re: help me on CURSOR [message #429622 is a reply to message #429612] Wed, 04 November 2009 15:03 Go to previous messageGo to next message
Michel Cadot
Messages: 65088
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
SQL is executed only once, cursor "contains" the execution and where in this execution plan the statement is.

Database Concepts
Chapter 24 SQL, PL/SQL, and Java
Section Overview of SQL
Paragraph SQL Processing/SQL Statement Execution

Re: help me on CURSOR [message #429627 is a reply to message #429612] Wed, 04 November 2009 15:25 Go to previous message
Messages: 25537
Registered: January 2009
Location: SoCal
Senior Member
When all else fails, Read The Fine Manual



A cursor is a handle or name for a private SQL area--an area in memory in which a parsed statement and other information for processing the statement are kept.

Previous Topic: ORA-00904: : invalid identifier during merge
Next Topic: Remove primary key
Goto Forum:

Current Time: Wed Jul 26 02:11:06 CDT 2017

Total time taken to generate the page: 0.08438 seconds