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
 

 

Can we declare a Cursor with distint operator

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

New User


Joined: 21 Oct 2005
Posts: 22

PostPosted: Thu Jun 12, 2008 5:36 pm    Post subject: Can we declare a Cursor with distint operator
Reply with quote

Hi All,


EXEC SQL

DECLARE X-CURSOR CURSOR FOR SELECT DISTINT(FILE_NO) INTO :WS-FILE_NO FROM MASTER_TABLE WHERE FILE_PROCESSD='P'
END-EXEC.


Is it possible to decalre a cursor with the distint operator
Back to top
View user's profile Send private message

Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 785
Location: Chennai, India

PostPosted: Thu Jun 12, 2008 5:39 pm    Post subject:
Reply with quote

DISTINT???

or

DISTINCT???

Why INTO clause???
Back to top
View user's profile Send private message
rohanatl

New User


Joined: 21 Oct 2005
Posts: 22

PostPosted: Thu Jun 12, 2008 6:01 pm    Post subject: Reply to: Can we declare a Cursor with distint operator
Reply with quote

sorry
DISTINCT is the one i need to use...

For EG:
this is the file structure..

File_no FILE_PROCESSD
11111 P
11111 P
11111 P
22222 P
33333 P
44444 P
44444 W
44444 W
44444 W
44444 W

By using the query in my program i want to fetch the file number by eliminating the duplicate values..

If i declare a cursor with out the Distinct function i will get all the records with status ="P"
Back to top
View user's profile Send private message
Suresh Ponnusamy

Active User


Joined: 22 Feb 2008
Posts: 107
Location: New York

PostPosted: Thu Jun 12, 2008 7:18 pm    Post subject:
Reply with quote

Yes.. You can use DISTINCT Clause in the Declare Cursor.
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 Updating Cursor row withour using FOR... chandan.inst DB2 15 Tue Nov 08, 2016 11:17 am
No new posts Variable for cursor names ravikumar15 DB2 5 Sun Jul 17, 2016 7:08 am
No new posts DB2 Stored Procedure - Dynamic SQL - ... GuyC DB2 2 Wed Feb 17, 2016 5:10 pm
No new posts ISREDIT - Position Cursor on the Comm... Tarique Anwer TSO/ISPF 5 Wed Feb 03, 2016 12:44 pm
No new posts ICETOOL "SUBSET" operator q... David Sde DFSORT/ICETOOL 2 Tue Jul 28, 2015 7:53 pm


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