Re: Multi column check constraint
From: Philip Lijnzaad <lijnzaad_at_ebi.ac.uk>
Date: 2000/05/22
Message-ID: <u7g0rb0zdu.fsf_at_o2-3.ebi.ac.uk>#1/1
>> (item_link_no is not null and voucher_id is null));
Date: 2000/05/22
Message-ID: <u7g0rb0zdu.fsf_at_o2-3.ebi.ac.uk>#1/1
>> alter table foobar add constraint exactly_one_null check (>> (item_link_no is null and voucher_id is not null) or
>> (item_link_no is not null and voucher_id is not null) or
>> (item_link_no is not null and voucher_id is null));
Heinz> A simpler condition should be
Heinz> item_link_no is not null or voucher_id is not null
ah, yes, of course, I started from the (wrong) assumption that exactly one should be non-null, then added the 'both not null' as afterthought. Cheers,
Philip
-- /dev/brain: character special (53/0) ----------------------------------------------------------------------------- Philip Lijnzaad, lijnzaad_at_ebi.ac.uk \ European Bioinformatics Institute,rm A2-24 +44 (0)1223 49 4639 / Wellcome Trust Genome Campus, Hinxton +44 (0)1223 49 4468 (fax) \ Cambridgeshire CB10 1SD, GREAT BRITAIN PGP fingerprint: E1 03 BF 80 94 61 B6 FC 50 3D 1F 64 40 75 FB 53Received on Mon May 22 2000 - 00:00:00 CEST