Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is cursor

Answer Posted / ramdeep garg

A cursor is a SELECT statement that is defined within the
declaration section of your PLSQL code. We'll take a look
at three different syntaxes for cursors.

Cursor without parameters (simplest)
The basic syntax for a cursor without parameters is:

CURSOR cursor_name
IS
SELECT_statement;



For example, you could define a cursor called c1 as below.

CURSOR c1
IS
SELECT course_number
from courses_tbl
where course_name = name_in;

The result set of this cursor is all course_numbers whose
course_name matches the variable called name_in.



Below is a function that uses this cursor.

CREATE OR REPLACE Function FindCourse
( name_in IN varchar2 )
RETURN number
IS
cnumber number;

CURSOR c1
IS
SELECT course_number
from courses_tbl
where course_name = name_in;

BEGIN

open c1;
fetch c1 into cnumber;

if c1%notfound then
cnumber := 9999;
end if;

close c1;

RETURN cnumber;

END;

Is This Answer Correct ?    7 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is Reduced List of Values?

2160


How can I introduce multiple conditions in like operator?

984


What is a table index?

1096


When do you get a .pll extension in oracle? Explain its importance

1039


How many memory layers are in the oracle shared pool?

1179


How would you go about verifying the network name that the local_listener is currently using?

2046


What is data file?

1101


What is an oracle database?

1033


How can we delete duplicate rows in a table?

971


How to convert characters to dates in oracle?

1091


I just want to maintain data like an employee can belongs to 3 or more departments . We can resolve this by using composite key but it avoids normalization rules. So Can anyone tell me how can I maintain data.

2181


When do you get a .pll extension in oracle?

1144


What is Undo Management Advisor in Oracle?

1095


What is the difference between count (*), count (expression), count (distinct expression)?

1002


What is a cursor in oracle?

1172