top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

add a Default Value Constraint

+4 votes
213 views

I'm trying to add a Default Value Constraint but only if the Constraint doesn't already exist.

posted Nov 3, 2014 by Muskan

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
you can only overwrite the constraint but can not check the if it is null or not.

1 Answer

+2 votes
 
Best answer

CREATE TABLE CUSTOMERS(
ID INT NOT NULL,
NAME VARCHAR (20) NOT NULL,
AGE INT NOT NULL,
ADDRESS CHAR (25) ,
SALARY DECIMAL (18, 2) DEFAULT 5000.00,
PRIMARY KEY (ID)
);

answer Nov 13, 2014 by Manikandan J
Similar Questions
+1 vote

I am using below statement but i got error.
ALTER TABLE XXXtable
ADD xxx_name varchar2(50) not null;

error message:
ORA-01758: table must be empty to add mandatory (NOT NULL) column

...