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 phantom read in db2?
What is the use of commit in db2?
Define check constraint.
How do you concatenate the firstname and lastname from emp table to give a complete name?
What does reorg do in db2?
Why do we use cursor?
Give the name of some fields form sqlca.
Define declaration generator (dclgen).
How can tablespace be moved to another dasd volume that is allocated for that tablespace?
What is db2 optimizer?
Explain how can you do the explain of a dynamic sql statement?
What is bufferpool in db2?
How to execute stored procedure in db2 command editor?
How can you validate Sql errors during cursor operation in db2 pgms and where do you code?
What is a collection in db2?