View previous topic :: View next topic
|
Author |
Message |
ritesh pandey
New User
Joined: 09 Feb 2007 Posts: 11 Location: Pune
|
|
|
|
how to use index in cursor? Please send me the sample code for the same. |
|
Back to top |
|
|
anandinmainframe
Active User
Joined: 31 May 2007 Posts: 171 Location: India
|
|
|
|
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 |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
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 |
|
|
|