首页 > 数据库技术 > 详细

Oracle index hint syntax

时间:2014-03-01 20:45:37      阅读:732      评论:0      收藏:0      [点我收藏+]

Question:  I added an index hint in my query, but the hint is being ignored.  What is the correct syntax for an index hint and how do I force the index hint to be used in my query?

Answer:  Oracle index hint syntax is tricky because of the index hint syntax is incorrect it is treated as a comment and not implemented.  Here is an example of the correct syntax for an index hint:

select /*+ index(customer cust_primary_key_idx) */ * from customer;

Also note that of you alias the table, you must use the alias in the index hint:

select /*+ index(c cust_primary_key_idx) */ * from customer c;

Also, be vary of issuing hints that conflict with an index hint.  In this index hint example, the full hint is not consistent with an index hint:

select /*+ full(c) index(c cust_primary_key_idx) */ * from customer c;

Oracle index hint syntax,布布扣,bubuko.com

Oracle index hint syntax

原文:http://www.cnblogs.com/reynold-lei/p/3574643.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!