Home » RDBMS Server » Server Administration » Constraint applies, but doesn't work
Constraint applies, but doesn't work [message #372798] Fri, 09 March 2001 12:45 Go to next message
Thomas P. Otten
Messages: 1
Registered: March 2001
Junior Member
I am trying to add a constraint to the 'plotted' field in an existing table. I only want values of 'Y' or null. I issue the following statement, which SQLPLUS
accepts without warning, yet the constraint does not work at all. I figured out that it is the 'null' part that it does not like. Does anyone know how to add a constraint where the only possible values are 'Y' and null?

Here is my code:
alter table drawings
add constraint plotted_Y_or_NULL check (plotted in ('Y', null));

Thanks
Re: Constraint applies, but doesn't work [message #372799 is a reply to message #372798] Fri, 09 March 2001 13:11 Go to previous message
Marcus Fernando
Messages: 34
Registered: September 2000
Member
Try to use:
alter table drawings
add constraint plotted_Y_or_NULL check (plotted = 'Y');
and Allow null values in this field.
Previous Topic: executing batch sql statements in oracle
Next Topic: Retreive data from table
Goto Forum:
  


Current Time: Sat Jun 29 13:57:48 CDT 2024