When I try to add this column:
alter table APL ADD CODE NUMERIC(2) NOT NULL
I get this error:
ALTER TABLE 'APL 'failed. Default clause is required in order to add non-NULL column 'CODE'.
I know I can add a default and it will work, but I DONT WANT A DEFAULT VALUE in this coloumn, i read and i heard that there is way that i can add the column with out a default.
anyone knows how ?
Edit:
Ill explain more about my case.
This column was created by mistake as NULL(I dont know why), and its part of primary key(luckily I have no duplicate), so I have to change it to NOT NULL , so I can assign it .
Its really an old column and I dont know what kind of default I should add, because if I add a wrong value the applications might cause problems.
I found this query that suits to me, it seems fine for me. Anyone tried this before ?
I add the column as NULL , then I modify it to not null.
alter table TEST_EMPLOYEE ADD COMP_CODE NUMERIC(4) NULL
alter table TEST_EMPLOYEE MODIFY COMP_CODE NUMERIC(4) NOT NULL