Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 HEX value search in a DB2 query maxsubrat DB2 2 Wed Oct 04, 2017 3:04 pm
No new posts Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts Can we limit length in concatenation ... balaji81_k DB2 7 Tue Aug 22, 2017 2:50 am
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

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us