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

Answers were Sorted based on User's Feedback



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

Answer / bigben

yes you can
declare cursor using FOR UPDATE option

Is This Answer Correct ?    23 Yes 0 No

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

Answer / diana

Yes you can update the table using cursor....
for eg: if you want to update 3 columns like A,B,C the you
can write as:

Update Table_name
Set A = :Host varaible(value)
B = :Host varaible(value)
C = :Host varaible(value)
where current of C1(Cursor name)

Is This Answer Correct ?    9 Yes 0 No

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

Answer / 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

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

Answer / siri

suppose we want update ename in emp table using cursor....

declare crsorname cursor for
select * from emp
where dept='d005'
for update of ename....


upate emp
set ename=:ename
where current of cursor

Is This Answer Correct ?    0 Yes 0 No

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

Answer / mee

yes its possible

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More DB2 Interview Questions

what is difference between Static call and Dynamic call? How does it function?

1 Answers   Syntel,


How do you run JCL in cobol program

1 Answers   IBM, Syntel,


What does runstats do in db2?

0 Answers  


What is copy pending status in db2?

0 Answers  


What are the four lockable units for DB2?

1 Answers  






How to find the maximum value in a column in the db2 database?

0 Answers  


when we are trying to update db2 rows. if the program abends . how we will know that the last successful update row was

5 Answers   IBM,


What is dclgen (declaration generator)?

0 Answers  


What is table space in db2?

0 Answers  


What should be specified along with a cursor in order to continue updating process after commit?

1 Answers   IBM,


If there is no row in Emp table with Ename as Raghava and you run the below queries in SPUFI. 1.select Ename from EMP wher Ename = 'raghava' 2.Select count(*) from EMP where Ename = 'raghava' What is SQLCODE shown up in SPUFI

4 Answers   ADP,


What is pagespace?

1 Answers  


Categories