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 |
How to get the ddl of a table in db2?
Can we use select query in a loop to fetch multiple rows in a COBOL PROGRAM? If so, what is the advantage of cursor?
What is the connection string to connect to the DB2 Database ?
What is check constraint. Explain with example.
How is the value function used?
5 rows are inserted to a DB2 Table. Next 3 of those are updated, then a rollback is issued. What would happen when the rollback is issued?
Do we need cursor for Count(*)?
I have a subprogram B calling from mainprogram A.I have opened a cursor in A ,Can i fetch the same cursor in subprogram B , If yes , Please explain the reason?
How many types of page locks can be held in db2?
what's the equivalent Cobol Data type for Decimal(x,y) in DB2? what does the current SQLID register contain?
3 Answers Cap Gemini, Tech Mahindra,
What is a NULL value? What are the pros and cons of using NULLS?
How would one remove old reorg information from the DB2 catalog?