Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 538
palAlaa Avatar asked Sep 27 '26 03:09

palAlaa


1 Answers

Something like:

CREATE TABLE mytable(   
   email varchar2(100), 
   cellphone varchar2(100),
   constraint null_check
   check (email is not null or cellphone is not null)
)
like image 114
skaffman Avatar answered Sep 28 '26 20:09

skaffman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!