Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Is it possible to define conditional unique constraint

CUBRID Official Forum » General Discussions » Is it possible to define conditional unique constraint

author
message
[Level:0]didxga

Post subject: Is it possible to define conditional unique constraint

registered: 01/23/2013

IP: *.91.139.81

views: 1

Cubrid unique constraint doesn't allow multiple Nulls, But in my case I just want to enforce unique constraint to all no null values, that is for the following schema

create table t (

    ID_ varchar(64) not null,

    EMP_ID varchar(64) not null,

    COM_ID varchar(64),

    NAME varchar(64) not null

);

alter table t

   add constraint UNIQ_T_EMP_COM

   unique(EMP_ID , COM_ID );

these inserts should not violate unique constraint
insert ('12', '23', null,  'blah');

insert ('13', '23', null,  'blah');

Is it possible to define that kind of unique constraint? Please point me out.


Thanks


Carter

Quote




You are either using a very old browser or a browser that is not supported.
In order to browse cubrid.org you need to have one of the following browsers:



Internet Explorer: Mozilla Firefox: Google Chrome: