View previous topic :: View next topic
|
Author |
Message |
soujanyavl
New User
Joined: 11 Jan 2006 Posts: 2 Location: pune
|
|
|
|
hi ,
I need to write a DB2 Cursor for retrieving data from Db2 Tables
Input: A set of values for one column and number of values are not fixed but at a max it can send 72 values.
To fetch all the rows using only one cursor and the cursor should be opened once in the whole Program. And associated with each value there are multiple rows.
How can I write and handle the Cursor in my program . |
|
Back to top |
|
|
sairam
New User
Joined: 30 Aug 2005 Posts: 58 Location: Kolkata
|
|
|
|
Hi,
You can declare the cursor in the program and make a condition;,i;e in where clause Where <col name> in (<set of values>). |
|
Back to top |
|
|
soujanyavl
New User
Joined: 11 Jan 2006 Posts: 2 Location: pune
|
|
|
|
hi sairam,
Do u mean that i should give 72 variables in my IN Clause? Is there no other way out? |
|
Back to top |
|
|
prabs2006
Active User
Joined: 12 Jan 2006 Posts: 103
|
|
|
|
Hi Soujan,
If Cursor is not mandatory, declare an array,store all the values and use a single select within a loop.
If Cursor is mandatory, use between if in case the values form a pattern else I dont see a way in doing this.
Please let us know if u had done by any other way.
T & R
Prabs |
|
Back to top |
|
|
|