can we update the table by using cursors can anyone post
the query?
Answers were Sorted based on User's Feedback
Answer / bigben
yes you can
declare cursor using FOR UPDATE option
| Is This Answer Correct ? | 23 Yes | 0 No |
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 |
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 |
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 install 2 different versions of Db2 on same mainframe?
What is Declaration Generator(DCLGEN)?
What is the difference between nvl and coalesce?
Write a query to retrive partial string.
What is null value in db2?
what are extents?
if suppose i am having an ACCOUNT table with 3 coloumns ACC. NO,ACC. NAME,ACC. AMOUNT . If a unique index is also defined on ACC.NO and ACC.NAME then write a query to retrieve account holders records who have more than 1 ACC.
How would you find out the total number of rows in a db2 table?
Is db2 a database?
Why use RUNSTAT Utility?
What is plan in cobol db2?
Where is the access path logic created by the DB2 Optimizer stored?