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
 
how to use index in cursor ?

 
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: Tue Mar 17, 2009 4:01 pm    Post subject: how to use index in cursor ?
Reply with quote

how to use index in cursor? Please send me the sample code for the same.
Back to top
View user's profile Send private message

anandinmainframe

Active User


Joined: 31 May 2007
Posts: 171
Location: India

PostPosted: Tue Mar 17, 2009 4:23 pm    Post subject: Reply to: how to use index in cursor ?
Reply with quote

ritesh pandey,
An index is used to retrieve the data efficiently
Code:

EXEC SQL                                           
SELECT                                             
FIELD                                           
INTO                                               
:WS-FIELD                               
FROM TABLE_NAME                                   
WHERE INDEX  = :WS-INDEX     
END-EXEC                                           
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1259
Location: Israel

PostPosted: Tue Mar 17, 2009 5:51 pm    Post subject:
Reply with quote

It is not you who use an index, it is DB2.
According to the WHERE clause, the ORDER BY clause, and other stuff, DB2 will decide to use - or not to use - an index.

If you want to know what will be used, you have to ask DB2 for some EXPLAINations...
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 KSDS and Index file in cobol deepak14450 COBOL Programming 9 Fri Dec 22, 2017 9:36 am
No new posts -502 Error - Cursor already open anand jeyapaul DB2 7 Sun Oct 29, 2017 4:22 am
No new posts Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm
No new posts Confusion b/w index and subscript Deepak kumar25 Mainframe Interview Questions 7 Thu Aug 31, 2017 6:50 am
No new posts SQL - select data available in index Nileshkul DB2 3 Mon Jun 26, 2017 1:30 am

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