Conditional Unique Indexes
Friday, May 17, 2013 at 11:25AM Matrix : What you must learn is that these rules are no different than rules of a computer system. Some of them can be bent, others can be broken. Understand?
--
-- SCOPE : OASIS
--
-- DDL:CALLITEMS_UK01 :INDEX.MOD - TEST
--DROP INDEX CALLITEMS_UK01;
CREATE UNIQUE INDEX CALLITEMS_UK01
ON CALLITEMS
( CASE UNIQUE_REF WHEN 1 THEN UPPER(TRIM(ITEMCODE)) ELSE NULL END
, CASE UNIQUE_REF WHEN 1 THEN ITEMTYPE ELSE NULL END
, CASE UNIQUE_REF WHEN 1 THEN ACTIVESINCE ELSE NULL END )
TABLESPACE OASISIXM
;
Dependend on the uniqeness flag UNIQUE_REF a row may be unique to others or not. Maybe this makes sense for specific call item types. In our project a CALLITEMTYPES table controlled the unqueness of specifc call item types , pupulating the UNIQUE_REF flag to the CATLLITEMS table.
cheers
/K

