This means that the Index Type is Function-Based Index

解决方案 »

  1.   

    To klyh(风笛) :
      能不能说详细一点,有什么办法可以解决? 谢谢。
      

  2.   

    你的Create index Ix_Test on tableName( columnName Desc );
    其中columnName上以前是否已经建过主键或唯一键约束了?
    如果是的话,这两种约束会建索引,默认的索引名会和约束名一样,当然
    如果建约束时没有起名字,oracle会起个系统的名字,默认以sys打头
      

  3.   

    风笛意思说,索引类型是基于函数索引。昨晚找篇资料,没有提过为何会起一个以sys开头的名字.难道oracle对降序有标记?
      

  4.   

    我试了一下,是可以的,但不过不是在dba_ind_columns而是在USER_ind_columns,请看:
    1、SQL> Select index_owner, COLUMN_NAME from dba_ind_columns where rownum<5;INDEX_OWNER                    COLUMN_NAME
    ------------------------------ ------------------------------ --------------------
    SYS                            OBJ#
    SYS                            FILE#
    SYS                            TS#
    SYS                            RELFILE#
    2、SQL> Select INDEX_NAME, TABLE_NAME,COLUMN_NAME from user_ind_columns where rownum<5;INDEX_NAME                     TABLE_NAME                     COLUMN_NAME
    ------------------------------ ------------------------------ --------------------
    PK_NET_CORPMEMBER_LIST         NET_CORPMEMBER_LIST            ID
    PK_T_BBS_CONTENT_ID            T_BBS_CONTENT                  ID
    PK_T_BBS_ITEM_ID               T_BBS_ITEM                     ID
    PK_T_DIC                       T_DIC                          ID
      

  5.   

    這些索引是系統幫你建的所以是以sys開頭。當你創立主key或唯一key時就有這種情況。Oracle treats descending indexes as function-based indexes. ASC | DESC 
    Use ASC or DESC to indicate whether the index should be created in ascending or 
    descending order. Indexes on character data are created in ascending or descending 
    order of the character values in the database character set. 
    Oracle treats descending indexes as if they were function-based indexes. You do not 
    need the QUERY REWRITE or GLOBAL QUERY REWRITE privileges to create them, as 
    you do with other function-based indexes. However, as with other function-based 
    indexes, Oracle does not use descending indexes until you first analyze the index 
    and the table on which the index is defined. See the column_expression clause 
    of this statement. 
    Restriction on ASC and DESC: You cannot specify either of these clauses for a 
    domain index. You cannot specify DESC for a reverse index. Oracle ignores DESC if 
    index is bitmapped or if the COMPATIBLE initialization parameter is set to a value 
    less than 8.1.0. 仔细以上内容吧
      

  6.   

    我刚才也考虑了一下,你所说的发现一些奇怪的字符是系统本身所有的索引,而用户自己建的索引通常不含有这样的字符,如果有也没有问题。
    也就是说,select * from dba_ind_columns是没有问题的,
    如果select * from user_ind_cloumns这样取也是没有问题,这并不矛盾,不知你是否能明白?
      

  7.   

    首先,索引名以sys开头.肯定不会是oracle对降序的标记!我也发现数据库中有些表的索引名有类似情况,不过出现机率很少;czhai(横扫千军) 最后说法的应该是符合情况的!在dba_ind_columns和user_ind_cloumns中,
    INDEX_NAME可能会出现系统给提供的索引名【以SYS打头】,
    不过COLUMN_NAME应该就是泥建索引的字段名;估计,泥可能把试图中的INDEX_NAME和COLUMN_NAME混淆了?
      

  8.   

    转贴:SQL> create table t(a int,b varchar2(10)); Table created SQL> create index inx_t1 on t(a desc); Index created SQL> create index inx_t2 on t(a desc,b asc); Index created SQL> create index inx_t3 on t(b desc); Index created SQL> create index inx_t4 on t(upper(b)); Index created SQL> select index_name,index_type,table_name from user_indexes where index_name like 'INX_T%'; INDEX_NAME INDEX_TYPE TABLE_NAME 
    ------------------------------ --------------------------- ------------------------------ 
    INX_T1 FUNCTION-BASED NORMAL T 
    INX_T2 FUNCTION-BASED NORMAL T 
    INX_T3 FUNCTION-BASED NORMAL T 
    INX_T4 FUNCTION-BASED NORMAL T SQL> select index_name,table_name,column_name from user_ind_columns where index_name like 'INX_T%'; INDEX_NAME TABLE_NAME COLUMN_NAME 
    ------------------------------ ------------------------------ ---------------------------- 
    INX_T1 T SYS_NC00003$ 
    INX_T2 T SYS_NC00003$ 
    INX_T2 T B 
    INX_T3 T SYS_NC00004$ 
    INX_T4 T SYS_NC00005$ 可以看到,desc的索引,oracle是当成函数索引来处理的。 
    inx_t4 与前面的索引一样