palAlaa
palAlaa

Reputation: 9858

Oracle null constraint

I have an email and cellPhone attributes in a table, one of them can be null and the other must not be null, how can I make constraint to prevent two values to be null?

Upvotes: 3

Views: 148

Answers (1)

skaffman
skaffman

Reputation: 403551

Something like:

CREATE TABLE mytable(   
   email varchar2(100), 
   cellphone varchar2(100),
   constraint null_check
   check (email is not null or cellphone is not null)
)

Upvotes: 10

Related Questions