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
 

 

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: 1232
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 SQL - select data available in index Nileshkul DB2 3 Mon Jun 26, 2017 1:30 am
No new posts Testing rerad cursor for status with ... John F Dutcher DB2 8 Fri May 19, 2017 9:35 pm
No new posts Getting -504 Cursor Name GTT-ARTS-CUR... Robin Sulsona DB2 2 Fri Mar 17, 2017 1:43 am
No new posts setting new limit Key values for inde... srilata83 DB2 1 Fri Feb 10, 2017 9:24 pm
No new posts Release of Adabas Cursor mohitsethi All Other Mainframe Topics 1 Mon Feb 06, 2017 8:36 pm


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