Specify Index on SDO

The query on my SDO is

FOR EACH Table NO-LOCK INDEXED-REPOSITION.

By using the addQueryWhere functionality, I can easily change this to

FOR EACH Table WHERE Condition1 AND Condition2 AND Condition3 NO-LOCK INDEXED-REPOSITION.

I want to force the query to use a particular index. How can I do this?

FOR EACH Table WHERE Condition1 AND Condition2 AND Condition3 USE-INDEX MyIndex NO-LOCK INDEXED-REPOSITION.
 

Stefan De Leyn

New Member
We have done this by simply replacing the entire Query by using the setQueryWhere function. If the pcWhere begins "FOR EACH ..." then the entire query is replaced and then you should be able to insert the USE-INDEX option into the Query.
I have personally never needed done it but in theory it should do the trick.
Dare you be a guinea-pig ?
 
Yes, that worked.

The beauty of addQueryWhere was you only had to specify the new condition. Obviously with this method, I'll have to do some manipulation on the original query string to insert the USE-INDEX prior to NO-LOCK INDEXED-REPOSITION.

Thanks. :)
 
Top