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
What is sqlca’s maximum length?
What is access path in db2?
What parameters are used to control the free space in DB2?
What is null in db2?
What is the difference between nvl and coalesce?
What is a bind card?
Explain packages.
What are the different types of base tables?
What is check constraint. Explain with example.
What does runstats do in db2?
How to find the maximum value in a column in the db2 database?
What is a cursor in programming?
Is it possible to alter a table – for example adding a column, when another user is accessing or updating some columns?
How can we read records for specific member in CL? AND rpg?
Following a db2 update statement, what is the quickest way to compute the total number of updated rows?