--Order# 502807
--delete first, so that the constraints can always be added
DELETE FROM I_UNIQUEPOOL;

alter table I_UNIQUEPOOL
  add constraint I_UNIQUEPOOL_STATUS_CHECK
  check ((STATUS=30 AND CUSTOMERNUMBER IS NULL) OR (STATUS=20 AND CUSTOMERNUMBER IS NOT NULL));

alter table I_UNIQUEPOOL
  add constraint I_UNIQUEPOOL_STAY_CHECK
  check (STAY BETWEEN 10 AND 99);
