【问题标题】:unique check with Descending Indexes使用降序索引进行唯一检查
【发布时间】:2012-02-27 06:30:06
【问题描述】:

我需要在一个表上创建一个唯一的检查,sql是这样的:

alter table SAMPLE
add constraint A_B unique (A, B)
using  index 
tablespace MASCITY
pctfree 10
initrans 2
maxtrans 255
storage
(
  initial 64K
  minextents 1
  maxextents unlimited
);

它会自动创建一个唯一索引,但我需要的是一个 a 为 asc 而 b 为 desc 的索引,就像:

create index A_B_Index on SAMPLE (a asc,b desc);

我的sql字符串怎么放?

【问题讨论】:

    标签: oracle indexing unique


    【解决方案1】:
    alter table MY_TABLE add constraint UK_X unique (A, B)
    using index (create unique index UK_X on MY_TABLE(A asc, b desc));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-22
      • 2015-08-10
      • 2016-08-11
      • 1970-01-01
      相关资源
      最近更新 更多