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 Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm
No new posts Need DB2 query to fetch previous row ! Chandan1993 DB2 10 Sat Jun 03, 2017 10:43 am
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm


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