I have 1000 rows in a db2 table.I want to update first 100
records,How do I do it?
Answer Posted / ananth
Declare a cursor like this in the application program
exec sql
Declare empcur cursor with hold for
select empno,empname from emp
for update of empsal
fetch first 100 rows only
end-exec.
this query will retrieve the first 100 rows and the cursor
is positiond at the first row in the resultent table.
| Is This Answer Correct ? | 23 Yes | 1 No |
Post New Answer View All Answers
What is the syntax for seeing the columns and data types of a table in the db2 database?
Are views updateable?
What does db2 plan contain?
Which component is used to execute the sql statements?
Explain the function done by data manager?
Which component is responsible for processing sql statements and selecting access paths?
What is the meaning concurrency in the db2 database?
What is lock escalation in db2?
I HAVE 500 ROW TO UPDATE I WOULD LIKE TO USE ROLLBACK ALONG WITH COMMIT.WHAT IS THE SYNTAX TO CODE COMMIT AND ROLLBACK FOR EVERY 100 ROWS.AND HOW THE CURSOR ROLLBACK TO THE LAST COMMITTING POINT.
What is copy pending and check pending in db2?
Can there be more than one cursor open for any program?
What is the use of commit in db2?
If the cursor is kept open followed the issuing of commit, what is the procedure to leave the cursor that way?
What is reorg and runstats in db2?
What is db2 catalog database?