I need to alter a table to add a new attribute column, give it a constraint to enforce a domain of three specific values, and a second constraint of a default value.
ALTER TABLE VIDEO
ADD VID_STATUS VARCHAR(4) NOT NULL
ADD CONSTRAINT VID_STAT1 CHECK(VID_STATUS IN('IN','OUT','LOST'))
ADD CONSTRAINT VID_STAT2 DEFAULT VID_STATUS = 'IN';
With that code, I am getting an ORA-00904: Invalid Identifier error on DEFAULT on the 4th line. Before this attempt, I tried combining the constraints into one constraint, and I would get an error on the first opening parenthesis of the following attempted line (Same Error):
ADD CONSTRAINT VID_STAT1(CHECK(VID_STATUS IN('IN','OUT','LOST')) AND DEFAUlT VID_STATUS = 'IN');
I thought I read somewhere that Oracle doesn't support the DEFAULT Constraint? If so, how would I set up a DEFAULT of this nature? My book acts like there is a DEFAULT Constraint that I can use, but an invalid identifier error makes me think there isn't, but I can't find anything to replace it with.
Any help would be great.

New Topic/Question
Reply


MultiQuote




|