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
 
Can we use where clause while fetching the records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
ritesh pandey

New User


Joined: 09 Feb 2007
Posts: 11
Location: Pune

PostPosted: Mon Sep 15, 2008 6:02 pm    Post subject: Can we use where clause while fetching the records
Reply with quote

Can we use where clause while fetching the records from db2 through cursor in db2?
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Mon Sep 15, 2008 6:09 pm    Post subject:
Reply with quote

yes.

keep in mind, that for embedded sql, a cursor is the only way to return more than one row.

so the difference between a cursor and a singleton-select is the expected return for a singleton-select is no more than one row.

so, anything that you can code for a singleton-select you can code for a cursor.

update cursors are only restricted in that you can not order them.
Back to top
View user's profile Send private message
Siddharth Bahirsheth

New User


Joined: 23 Jul 2007
Posts: 16
Location: Mumbai

PostPosted: Mon Sep 15, 2008 6:38 pm    Post subject: Reply to: Whhere clause
Reply with quote

I think he mean to say..a FETCH CURSOR query ...Can we use a where clause in a FETCH CURSOR .
Back to top
View user's profile Send private message
Shobana Bhaskar

New User


Joined: 02 Mar 2007
Posts: 35
Location: Pennsylvania, US

PostPosted: Tue Sep 16, 2008 2:22 am    Post subject: Reply to: Can we use where clause while fetching the records
Reply with quote

You have to include WHERE clause in DECLARE CURSOR statement. You cannot have in FETCH statement. Fetch statement will get the values from table for the filters (WHERE clause) defined in DECLARE CURSOR statement.
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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 22 Sun Aug 27, 2017 10:35 pm
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm

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