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

suppose in my table 10 rows are there , i want to update odd
rows salary as 90000 ? how u do it ? any one help me ? what
do we use here cursor-fetch or normal sql ?

Answer Posted / krishna

Declare:
EXEC SQL
DECLARE CURSOR C1 FOR SELECT SAL FROM EMP FOR
UPDATE SAL
END-EXEC.
OPEN:
OPEN C1
FETCH:
PERFORM UNTILL SQLCODE=100
FETCH C1 INTO :SAL
UPDATE EMP SET SAL=9000 WHERE CURRENT OF C1
FETCH C1 INTO :SAL
END-PERFORM

Is This Answer Correct ?    10 Yes 13 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is sqlca’s maximum length?

1174


What is access path in db2?

978


What parameters are used to control the free space in DB2?

1049


What is null in db2?

1011


What is the difference between nvl and coalesce?

1057


What is a bind card?

1211


Explain packages.

1105


What are the different types of base tables?

1085


What is check constraint. Explain with example.

1092


What does runstats do in db2?

1096


How to find the maximum value in a column in the db2 database?

1065


What is a cursor in programming?

1057


Is it possible to alter a table – for example adding a column, when another user is accessing or updating some columns?

1073


How can we read records for specific member in CL? AND rpg?

689


Following a db2 update statement, what is the quickest way to compute the total number of updated rows?

1060