Reputation: 53
I am trying to add a new column to a table as below but it is throwing me error.
ALTER TABLE YBC.POLICY_NON_FIN ADD COLUMN PAY_FREQ CHARACTER(2) NOT NULL;
[Error] Script lines: 26-27 ------------------------ In an ALTER TABLE statement, the column "PAY_FREQ" has been specified as NOT NULL and either the DEFAULT clause was not specified or was specified as DEFAULT NULL.. SQLCODE=-193, SQLSTATE=42601, DRIVER=3.67.28
So I cannot add not null during alter statement. Is it mandatory to add as default ?
Upvotes: 0
Views: 9586
Reputation: 38023
specify a default, otherwise it would be null
when you add it.
ALTER TABLE YBC.POLICY_NON_FIN
ADD COLUMN PAY_FREQ CHARACTER(2) NOT NULL default '';
Upvotes: 3