IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Can we declare a Cursor with distint operator


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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: 792
Location: Chennai, India

PostPosted: Thu Jun 12, 2008 5:39 pm
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Is SQLCODE -811 possible while fetchi... DB2 1
No new posts Restart logic by using cursor name in... DB2 1
No new posts Seeking Resolution for SQKCODE -991 o... DB2 2
No new posts Multiple rows within Cursor when Coun... DB2 14
No new posts Dynamic cursor name in Cobol program COBOL Programming 1
Search our Forums:

Back to Top