Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
6Activity
0 of .
Results for:
No results containing your search query
P. 1
13 Cursors Exception

13 Cursors Exception

Ratings: (0)|Views: 1,085 |Likes:
Published by api-3827483

More info:

Published by: api-3827483 on Oct 18, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as RTF, PDF, TXT or read online from Scribd
See more
See less

03/18/2014

pdf

text

original

cursors
sobjectives :

\u2013explain what is a cursor
\u2013list the types of cursors
\u2013list & explain implicit cursor & its attributes
\u2013state & explain syntax for declaring, opening and fetching data

from explicit cursors

\u2013list & explain explicit cursor attributes
\u2013explain a cursor for loop
\u2013construct a pl/sql programs using cursors

swhat is a cursor ?
\u2013a cursor is a pl/sql construct that lets you individually
manipulate each row in a set of rows returned by a
query
\u2013a cursor allows row by row processing of a data in a table
cursor management in pl/sql
swhen sql commands are executed, oracle uses work
areas
sthis storage area is called the implicit cursor
spl/sql allows users to name the private work areas
and access the stored information
scursor attributes are predefined variables that are
helpful in finding out the details about the cursor
cursors
sthere are two types of cursors
\u2013implicit cursors
san implicit cursor is created implicitly by pl/sql
\u2013explicit cursors
san explicit cursor is a user defined cursor
implicit cursor
screated by oracle automatically with default name
sql
syou cannot process data by using an implicit cursor
syou can use certain attributes to access information
about the most recently executed statement
sattributes are prefixed by keyword sql
simplicit cursor attributes are :

\u2013sql%notfound
\u2013sql%found
\u2013sql%rowcount
\u2013sql%isopen

implicit cursor
attribute
description
sql%notfoundresult of the dml statement (boolean )
- true if not successful
- false if successful
sql%found

result of the dml statement (boolean )
- true is successful (i.e.
dml returned at least one

row)
- false if not successful
sql%rowcountcontains number of rows
( number )
affected by last sql statement
sql%isopen

false always because oracle ( boolean )
automatically closes implicit
cursor after executing its

sql statement
scursor methods

\u2013open
\u2013fetch and
\u2013close methods

cannot be used with implicit cursor sql
implicit cursor
sexample
declarev_rowsaffected
number (6);
begin

update emp set comm = 500
where job = \u2018salesman\u2019;
v_rowsaffected := sql%rowcount;
insert into updated_records
values (\u2018emp\u2019, v_rowsaffected, \u2018salesman\u2019, sysdate);

end;
explicit cursor
san explicit cursor is a user defined cursor
spl/sql allows you to process the rows returned by a
query by using an explicit cursor

syou can process data in an explicit cursor
sdefined in the declaration section of the pl/sql block
smanipulation is done through open, fetch and close

statements
sprocessing information can be accessed using its
attributes
ssteps in using explicit cursor are :

\u2013declaring a cursor
\u2013opening a cursor
\u2013fetching rows from an opened cursor
\u2013closing a cursor

declaring a cursor
sa cursor is defined in the declaration section of the
pl/sql block
sdeclaring a cursor is defining its active set of rows
sthis active set of rows can be used to view or modify
data

Activity (6)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
Maxilyneth Bias liked this
thiyagani liked this
beauty liked this
beauty liked this

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->