IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

needed help for writing a query


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
soujanyavl

New User


Joined: 11 Jan 2006
Posts: 2
Location: pune

PostPosted: Thu Jan 19, 2006 10:00 am
Reply with quote

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
View user's profile Send private message
sairam

New User


Joined: 30 Aug 2005
Posts: 58
Location: Kolkata

PostPosted: Thu Jan 19, 2006 10:50 am
Reply with quote

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
View user's profile Send private message
soujanyavl

New User


Joined: 11 Jan 2006
Posts: 2
Location: pune

PostPosted: Thu Jan 19, 2006 12:21 pm
Reply with quote

hi sairam,

Do u mean that i should give 72 variables in my IN Clause? Is there no other way out?
Back to top
View user's profile Send private message
prabs2006

Active User


Joined: 12 Jan 2006
Posts: 103

PostPosted: Thu Jan 19, 2006 5:22 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts RC query -Time column CA Products 3
No new posts Dynamically pass table name to a sele... DB2 2
No new posts Two input files & writing counter... DFSORT/ICETOOL 12
No new posts Query on edit primary command CLIST & REXX 5
No new posts Query on edit primary command CLIST & REXX 1
Search our Forums:

Back to Top