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

Hi Everyone... Under the Logical files, when am working on multiple rec format logical file, I have joined two pf's using the multiple record format logical file concept, but when i run queried the LF only the first mentioned pf records are reflecting and I am not able to see any of the field records specified under the second pf. Kindly let me know whats the reason behind this. Below is the str of LF., R rec PFILE(LOGICAA) CUSTNO CUSTNAME BILL K CUSTNO R rec1 PFILE(LOGICAA1) CUSTNO ADD K CUSTNO .....

1914


How to create db2 table in mainframe?

648


What is the use of predicate?

600


What is a db2 schema?

772


What is package in db2 mainframe?

570






What is the maximum size of a char data type in db2?

594


What is the meaning concurrency in the db2 database?

649


What is database manager in db2?

563


Cursors can be declared in both working-storage & procedure division, agreed. But is there any difference? If could you please suggest what is the difference

770


Is it possible to create an Instance in DB2 using DB2 Control Center ?

641


How do you concatenate the firstname and lastname from emp table to give a complete name?

613


How to retrieve rows from a db2 table in embedded sql?

749


What is cursor with hold option in db2?

626


What does db2 blu stand for?

682


What is an instance database?

612