Change a column

You can change a column definition in a table using the ALTER COLUMN clause of the ALTER TABLE statement.

When you change the data type of an existing column, the old and new attributes must be compatible. You can always change a character, graphic, or binary column from fixed length to varying length or LOB; or from varying length or LOB to fixed length.

When you convert to a data type with a longer length, data will be padded with the appropriate pad character. When you convert to a data type with a shorter length, data may be lost due to truncation. An inquiry message prompts you to confirm the request.

If you have a column that does not allow the null value and you want to change it to now allow the null value, use the DROP NOT NULL clause. If you have a column that allows the null value and you want to prevent the use of null values, use the SET NOT NULL clause. If any of the existing values in that column are the null value, the ALTER TABLE will not be performed and an SQLCODE of -190 will result.

Related reference
Allowable conversions
Related information
ALTER TABLE