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

How to find schema of a table in db2?

570


Can you use max on a char column?

638


Explain dclgen.

722


What are the uses of db2 optimizer?

815


Is db2 relational database?

572






What are the various isolation levels possible?

647


How does a cursor work?

554


can all users have the privilage to use the sql statement select * (dml)?

638


DB2 can implement a join in three ways using a merge join, a nested join or a hybrid join. Explain the differences?

2274


Highlight all the advantages that are attached to a package.

627


Is db2 a programming language?

602


How to find the number of rows in db2 tables?

614


What is lock escalation in db2?

574


What are sqlcodes –803,-805, -811, -818,-904,-911,-913,-101, +100?

706


What does db2 blu stand for?

658