Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

needed help for writing a query

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: needed help for writing a query
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    Post subject:
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Join in SQL Query vickey_dw DB2 2 Tue Jan 17, 2017 12:15 am
This topic is locked: you cannot edit posts or make replies. MQ setup query mohitsaini Java & MQSeries 4 Sun Jan 08, 2017 1:53 am
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us