Вы находитесь на странице: 1из 2

cursor:

each sql query should be processed under curser area


before dispalying of output to the client machine.
cursor is nothing but temerary memory area to perform intermedeaite opartions
before output delivered to the client.
in this cursor area table data processed against the query.

user---->query----->oracle oracle db:


engine dd data dictionary----
structutes of
oracle
objects(metadata)
'
' ad actual data----->data in the
obejcts
set of data
blocks/
' datablock is
storage area
each datablock
contains set of records
query--------------> sql statement
or
queries from pl/sql executer
'
' programmins statemnts
user ------>programe/procedure ----> progrming statemens----------- pl/sql
engine

the data will be opened under temporary area(memory)


this temporary memory is called cursor.
the records are verified under cursor area;
if the records are satiesfied send to the client other wise skipp the records
the condition verification done under temparory area
each and every query uses cursors;

curser types:

implicit cursor:
it is managed/created by oracle engine
alloacation and dealloaction done by oracle engine
used by every sql query
implicit cursor properties:
sql%isopen :if the table opens for processig terurns true
otherwise false
sql%found:data is found returns true
sql%notfound:if data is not found returns true
sql%rowcount:return one integer value
having the value which representing no effecting
records

implicit cursor properties are used with sql keyword


explicit cursor
is it temporary memory
to dispaly multiple records using program/procedure
are managed by user
having 4 steps:
1)declare cursor:
cursor <name> is
select etc from table
2)open cursor
open <cursorname>
3)fetch data from cursor
fetch <cursorname> into <var> use fetch inside the loop and exit
4)close cursor
close <cousorname>
deallaoctes the memory used by table data
explicit cursor properties:
<cursorname>%isopen :if the table opens for processig terurns true
otherwise false
<cursorname>%found:data is found returns true
<cursorname>%notfound:if data is not found returns true
<cursorname>%rowcount:return one integer value
having the value which representing no effecting
records

Вам также может понравиться