Changing Column Attributes: NOT NULL or NULL
When changing columns from NULL to NOT NULL, or from NOT NULL to NULL, refer to the following table.
| Column Attribute | Composite Changes |
|---|---|
| NULL | Not permitted. |
| NOT NULL | Permitted. |
The following rules define how columns defined with NULL or NOT NULL attributes can be altered:
| Column Type | NULL or NOT NULL | Type to Which You Can Alter Column |
|---|---|---|
| Indexed | NULL | NULL |
| NOT NULL | NOT NULL | |
| Unindexed | NULL | NOT NULL if and only if the column does not contain nulls. |
| NOT NULL | NULL |
Data Type and Attribute Definitions
The data type defined for a column can be changed only if the new type does not require a change to the existing data. The rules for changing the data type of a column are listed in Rules for Changing Column Data Types. Also see Procedure to Change Column Data Types.
For an existing column, the following rules are true for data types and attributes with the exception of LOB data types.
- FORMAT, TITLE, DEFAULT, or WITH DEFAULT phrases.
- Changes in data type attributes or in data types in cases where the change does not require rewriting existing rows.
The following table provides examples of valid and non-valid type and attribute definition changes.
| Original Form | New Form | Valid or Invalid |
|---|---|---|
| CASESPECIFIC | NOT CASESPECIFIC | Valid |
| NOT CASESPECIFIC | CASESPECIFIC | Valid |
| CASESPECIFIC | UPPERCASE | Invalid |
| VARCHAR(6) | VARCHAR(12) | Valid |
| VARCHAR(12) | VARCHAR(6) | Invalid |
- NULL
- NOT NULL
- TITLE
- FORMAT
No other data type attributes are permitted for BLOB or CLOB data.
You cannot specify a character data set of KANJI1 for CHARACTER, VARCHAR, or CLOB data types.
Changing a Data Type Attribute
The display attributes FORMAT and TITLE can be altered at any time and a new DEFAULT declared.
The following rule applies to this class of table modifications: you can declare either the CASESPECIFIC or the NOT CASESPECIFIC attribute for character columns.