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...

Write a simple program on cursors

Answer Posted / subhendu

CREATE OR REPLACE Function test( I_name IN varchar2 )
RETURN number
IS

CURSOR c1
IS
SELECT course_number,
instructor
from courses_tbl
where course_name = I_name
FOR UPDATE of instructor;

v_number courses_tbl.course_number%type;
v_instructor courses_tbl.instructor%type;

BEGIN

open c1;
fetch c1 into v_number,v_instructor ;

if c1%found then

UPDATE courses_tbl
SET instructor = 'SMITH'
WHERE CURRENT OF c1;

COMMIT;

end if;
close c1;
RETURN v_number;

END;

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I debug a stored procedure?

1095


how to implement one-to-one, one-to-many and many-to-many relationships while designing tables? : Sql dba

958


What is pl/sql table? Why is it used?

1014


How to run sql statements through the web interface?

1021


what are date and time intervals? : Sql dba

1035


What are the two types of periodical indexes?

925


what are set operators in sql? : Sql dba

1023


What is the purpose of primary key?

1003


Which data type is a composite type?

974


What is the difference between microsoft access and sql server?

1033


What kind of join is join?

947


What is pls_integer in pl sql?

1074


What is data types in sql?

983


How many types of tables are there?

933


What are character functions?

1073