问题
How to add notnull constraint to a column of an existing table in which no value is yet inserted i.e. only table is created and now i want to alter the table i am writing the following query
ALTER TABLE TABLENAME MODIFY COLUMNAME DATATYPE NOT NULL;
but oracle is throwing error "invalid alter table option"
回答1:
In an alter table you only have to specify what changes
ALTER TABLE TABLENAME MODIFY COLUMNAME NOT NULL;
As you don't change the datatype, you don't have to specify it again.
来源:https://stackoverflow.com/questions/46516768/add-notnull-constraint-to-a-column-of-an-existing-table