can we update the table by using cursors can anyone post
the query?

Answer Posted / amar

DECLARE
INT NUMBER:=0;
CURSOR C1 IS
SELECT COL1,COL2 FROM TABLE_NAME;
BEGIN
FOR RC IN C1 LOOP
UPDATE TABLE_NAME SET COL_NAME=RC.COL1,COL_NAME=COL2;
CNT:=CNT+1;
END LOOP;
END;

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a db2 table?

593


What is null value in db2?

557


What is a dbrm in db2?

574


What is sqlca?

608


How can you do the explain of a dynamic sql statement?

629






What parameters are used to control the free space in DB2?

640


What is db2 optimizer?

763


How do I delete a table in db2?

640


Give a brief description of db2 isolation levels?

597


What are packages in db2?

593


What is a bind in db2?

587


How to access db2 tables in mainframe?

611


What is the difference between bind and rebind in db2?

846


What is the physical storage length of the data types: date, time, timestamp in the db2 database?

638


Who uses db2?

569