AC032698
asked on
How to use specific index with SELECT
I develop database applications with Delphi 3 based on Oracle 7.3.2 and local Paradox tables. I want to be able to use a definite index in SELECT clauses (I don't want an index to be automatically selected if available by DB system). Need two simple examples about syntax, one for Paradox and one for Oracle, if they are different.
ASKER
I said that I want to use an index determined by ME, even though it might be worse than any automatically selected index. Also, a SELECT clause with ORDER BY gives a read-only result set.
SELECT * FROM TABLE INDEX=NAME
That will do the Job I guess :-)
You can also gives an index ID insteed of the name
That will do the Job I guess :-)
You can also gives an index ID insteed of the name
ASKER
I am sorry but it does not work. Have you ever tried it??
Well it comes from the SQL server documentation never tried with ORACLE or PARADOX :-)
SELECT * FROM {table_name | view_name}[(optimizer_hint s)]
[, {table_name2 | view_name2}[(optimizer_hin ts)]
where
(optimizer_hints)
Indicate that a specific locking method, a specific index, or no index (table scan) should be used (by the optimizer) with this table for this SELECT.
INDEX = {index_name | index_id}
Specifies the index name or ID to use for that table.
[, {table_name2 | view_name2}[(optimizer_hin
where
(optimizer_hints)
Indicate that a specific locking method, a specific index, or no index (table scan) should be used (by the optimizer) with this table for this SELECT.
INDEX = {index_name | index_id}
Specifies the index name or ID to use for that table.
This is the same answer as mine AC ;-) Maybe do you have to give the exact SQL with the right table name and the right index to make it work :-)
ASKER
Thank you for your interest friends. I, too, have some documents and some URLs describing the specific index usage, quite similar to yours. But they don't work. I tried almost all kinds with Paradox, Oracle and Adabas ODBC. I don't think that I use wrong index name, number, etc. What I really need is just an example which is really tried by an experienced expert.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi sganta!
It is great answer! Thank you very much. And Jesus loves you as well; excellent grade.
It is great answer! Thank you very much. And Jesus loves you as well; excellent grade.
SELECT * FROM EXAMPLE_TABLE
ORDER BY FIELD1+FIELD2
The DBMS will select the right index (or combination of indexes) for you. This works on both oracle and paradox.
John