Chinaunix首页 | 论坛 | 博客
  • 博客访问: 33011
  • 博文数量: 7
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 75
  • 用 户 组: 普通用户
  • 注册时间: 2014-03-13 13:28
个人简介

沃布滋道.硕典莎

文章分类

全部博文(7)

文章存档

2020年(2)

2019年(5)

我的朋友

分类: Oracle

2019-09-23 13:04:23

虽然我们都知道在定义较长的字段上建索引是没有意义的,但是避免不了有些同事还是会做这样的事情,刚好我遇到了,所以记录下来
SQL> select *from t;


        ID NAME
---------- --------------------
         1 a
         2 b
        10 c
         9 d
         8 e
         7 f


6 rows selected.


1.先加一个字段长度为4000的,建索引没问题,建索引加online报错。
SQL> alter  table t add describtion varchar2(4000);


Table altered.


SQL> create index ind_t_desc on t(describtion);


Index created.


SQL> drop index ind_t_desc ;                


Index dropped.


SQL> create index ind_t_desc on t(describtion) online;
create index ind_t_desc on t(describtion) online
                           *
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-01450: maximum key length (3215) exceeded




2.加一个字段长度为3200的,加online建索引没问题
SQL> alter  table t add describtion varchar2(3200);


Table altered.


SQL> create index ind_t_desc on t(describtion) online;


Index created.




3.加一个字段长度为3201的,加online建索引也没问题
SQL> alter  table t add describtion varchar2(3201);


Table altered.


SQL> create index ind_t_desc on t(describtion) online;


Index created.




4.加一个字段长度为3202的,建online报错;
SQL> alter  table t add describtion varchar2(3202);


Table altered.


SQL> create index ind_t_desc on t(describtion) online;
create index ind_t_desc on t(describtion) online
                           *
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-01450: maximum key length (3215) exceeded




阅读(2373) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~