易截截图软件、单文件、免安装、纯绿色、仅160KB

Using Oracle Index Hints in SQL statements

Using Oracle Index Hints in SQL statements
Hints are used to give specific information that we know about our data and application, to Oracle. This further improves the performance of our system. There can be instances where the default optimizer may not be efficient for a certain SQL statements. We can specify HINTS with the SQL statements, to improve the efficiency of those SQL statements.
In this article, we shall see how to specify INDEX hints and what the advantages of the same are.
1      How to specify Hints
The Hints are enclosed in comment, /* comment */, in an SQL statement, and can only be specified with SELECT, DELETE and UPDATE keyword.
SELECT /* comment */ ........ ;
All hints should start with a + sign. This tells the SQL Parser that the SQL has a hint specified with it.
SELECT /*+{hint} */ ........ ;
2      Using INDEX Hints
When you specify an INDEX Hint, the optimizer knows that it has to use the INDEX specified in the hint. In this case, the optimizer does not go for a Full Table Scan nor does it use any other index. In addition, it does not calculate the cost of the Index to be used.
If no INDEX hint is specified the optimizer determines the cost of the each index that could be used to access the table and uses the one with the lower cost.
If there are multiple indexes specified with the Hint then the optimizer has to determine the cost of each index to be used with the specified table. Once that is determined, it uses the Index with the lower cost to access the table. In this case, the optimizer does not do a FULL Table Scan. Also note that, the optimizer may choose to use multiple indexes and then merge the result sets to access the table. This method is used if the cost is low.
Syntax:
/*+ INDEX ( table [index [index]...] ) */
Where:
table specifies the name or alias of the table associated with the index to be scanned.
index specifies an index on which an index scan is to be


相关文档:

SQLServer和Oracle常用函数对比


数学函数
在oracle 中distinct关键字可以显示相同记录只显示一条
  1.绝对值
  S:select abs(-1) value
  O:select abs(-1) value from dual
  2.取整(大)
  S:select ceiling(-1.001) value
  O:select ceil(-1.001) value from dual
  3.取整(小)
  S:select floor(-1.001) value ......

oracle与sqlserver执行count(*)返回的结果兼容

由于以前都是在sqlserver 2005处理,现在客户要求oracle数据库服务器,
最初的代码为:
allRecordSize = (Integer) rs1.getObject(1);    //Integer allRecordSize=0;
当执行的时候报:BigDecimal无法转化为Integer类型
为了兼容两者修改后的代码为:
  Object o = rs1.getObject(1);
 &nbs ......

oracle 表空间操作

oracle表空间操作详解
  1
  2
  3作者:   来源:    更新日期:2006-01-04 
  5
  6 
  7建立表空间
  8
  9CREATE TABLESPACE data01
 10DATAFILE '/ora ......

oracle系统表查询【GBUnix】

【转】http://www.gbunix.com/htmldata/2004_06/2/5/article_53_1.html
oracle系统表查询【GBUnix】
 
数据字典dict总是属于Oracle用户sys的。
  1、用户:
   select username from dba_users;
  改口令
   alter user spgroup identified by spgtest;
  2、表空间:
   select * fro ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号