Joined: 07 Apr 2010 Posts: 94 Location: Bangalore, India
Requirement - to be accomplished via COBOL
TABLE A : TABLE B = 1 : many
1. Select 1 row from TABLE A - about 600 bytes of data per row.
2. Fetch upto 100 records from TABLE B based on COL1 from TABLE A - about 20 bytes of data per row.
3. Perform 1 and 2 until a list of values - COL1, gets exhausted
Can any one suggest the better option in terms of efficiency, performance and cost from the below 2 - both the tables have millions of rows?
A. Use 1 cursor, use JOIN to combine TABLE A & TABLE B and retrieve the required rows.
B. Use 2 cursors, open cursor 1, fetch first row, open cursor 2, fetch all rows, close cursor 2, fetch second row in cursor 1, open cursor 2, fetch all rows, close cursor 2 and so on.