Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Check Contraint Question

Check Contraint Question

From: Lyndon Tiu <ltiu_at_alumni.sfu.ca>
Date: Fri, 03 Dec 2004 11:46:39 -0800
Message-ID: <41B0C29F.3050402@alumni.sfu.ca>


Hello,

Could use some help here.

Table1 has:

Column1 varchar(32) is non-unique
and
Column2 number(1) with a constraint check (Column2 in ('0','1'))

Now I need to enforce another check constrains that says:

for every distinct Column1, you can only have a max of one Column2 = '1'. The rest of Column2 for that distinct Column1 being all '0'.

How do I write the check constraint for this?

Thank you for your help.

--

Lyndon Tiu
--

http://www.freelists.org/webpage/oracle-l Received on Fri Dec 03 2004 - 13:44:44 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US