suppose in my table 10 rows are there , i want to update odd
rows salary as 90000 ? how u do it ? any one help me ? what
do we use here cursor-fetch or normal sql ?
Answer Posted / krishna
Declare:
EXEC SQL
DECLARE CURSOR C1 FOR SELECT SAL FROM EMP FOR
UPDATE SAL
END-EXEC.
OPEN:
OPEN C1
FETCH:
PERFORM UNTILL SQLCODE=100
FETCH C1 INTO :SAL
UPDATE EMP SET SAL=9000 WHERE CURRENT OF C1
FETCH C1 INTO :SAL
END-PERFORM
| Is This Answer Correct ? | 10 Yes | 13 No |
Post New Answer View All Answers
What are the various data types available in db2?
What is db2 catalog database?
define clustering index.
Are view updateable?
What is db2 look?
What is the physical storage length of time data type?
What is alias in db2?
Explain dclgen.
What is the physical storage length of the data types date, time, and timestamp?
What is the maximum number of columns in a db2 table?
What are the 2 sqlcodes that are returned?
What is the difference between bind and rebind in db2?
have 3 tables table1, table2 and table3 which contains employee information. table1 is master table, table2 contains emp details like emp no and so on, table 3 contains emp salary. so if any emp leave company between 25th - 30th of every month it has to get updated in tables. but it is not getting updated. What is the reason.
How to take backup of table in db2?
What is a page in db2?