View previous topic :: View next topic |
Author |
Message |
sreen Beginner
Joined: 01 Apr 2003 Posts: 2 Topics: 1
|
Posted: Fri May 02, 2003 9:50 am Post subject: Declaring a Cursor |
|
|
I need to read a table which contains 5 million records sequentially ( cobol - db2 batch program ) from first record until the end of the table.
This is the logic I have in place.
move spaces to index1
declare curosr cursor1 with hold for
select * from table1 where column1 > :index1
I suspect there is a better way of doig this but ...
Any ideas or suggesstions will be helpful.
Thank You in advance,
Sreen |
|
Back to top |
|
|
SureshKumar Intermediate
Joined: 23 Jan 2003 Posts: 211 Topics: 21
|
Posted: Fri May 02, 2003 10:49 am Post subject: |
|
|
If you are not performing any inserts or updates and no commit logic, you may exclude withhold, remove the where clause and let DB2 do a tablespace scan which is a better option under these circumstances. If no updates, and logically feeasible you may add WITH UR. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Fri May 02, 2003 12:37 pm Post subject: |
|
|
Sreen,
I would suggest unloading the db2 table and read the flat file via a cobol program which saves a lot of times as well as resources.
Hope this helps...
cheers
kolusu |
|
Back to top |
|
|
|
|