what is the syntax for FOR UPDATE CLAUSE in cursor
declaration and how can u update using cursor? is it
possible to update multiple rows at a time.

Answer Posted / vaneesh khurana

EXEC SQL
DECLARE STUDENT-CSR CURSOR
SLECT NAME, CLASS, MARKS, STATUS
FROM STUDENT-TABLE
WHERE ROLL-NO = :WS-ROLL-NO
FOR UPDATE OF STATUS
END-EXEC

EXEC SQL
UPDATE STUDENT-TABLE SET STATUS =:WS-STATUS
WHERE CURRENT OF STUDENT-CSR
END-EXEC

Is This Answer Correct ?    6 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of commit in db2?

813


What are the different types of base tables?

767


Explain what are the various isolation levels possible?

791


What's The Percentage Free Space ?

960


How does a cursor work?

746


What is an instance in db2?

754


While unloading huge amount of data from table. Suddenly job failed some error. Imagine 1M data unloading, In that 90% data unloaded only 10% left, So if want to unload the rest 10% what needs to be done? Whether do i need to start from top or anything ?

2083


Can you tell me how can you find out the # of rows updated after an update statement?

855


Is db2 free?

855


Explain in brief how does db2 determine what lock-size to use?

778


How does cobol compile db2 program?

810


What is the difference between cursor and select statement?

837


How is the value function used?

835


What is a system catalog table in db2?

826


How do you simulate the explain of an embedded sql statement in spufi/qmf?

839