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 bind in db2?

608


How many types of page locks can be held in db2?

593


Which isolation level provides highest data integrity?

599


Why cursor is used in db2?

577


What is load utility in db2?

668






How do I delete a table in database?

599


Which component is used to execute the sql statements?

624


What is db2? Explain.

606


Is db2 a database?

574


What is nvl in db2?

628


How to get the ddl of a table in db2?

679


Is db2 relational database?

574


What are the prerogatives?

617


What is db2 command?

586


Comment whether dclgen is mandatorily used. If not, then what is the point of using it?

614