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
How to find schema of a table in db2?
Can you use max on a char column?
Explain dclgen.
What are the uses of db2 optimizer?
Is db2 relational database?
What are the various isolation levels possible?
How does a cursor work?
can all users have the privilage to use the sql statement select * (dml)?
DB2 can implement a join in three ways using a merge join, a nested join or a hybrid join. Explain the differences?
Highlight all the advantages that are attached to a package.
Is db2 a programming language?
How to find the number of rows in db2 tables?
What is lock escalation in db2?
What are sqlcodes –803,-805, -811, -818,-904,-911,-913,-101, +100?
What does db2 blu stand for?