How to alter the data type of a column on DB2
set data type
See the example below:
Table Name: fruit
Column name: color
db2 describe table fruit
Output:
Column Type Type
name schema name Length Scale Nulls
------------------------------ --------- ------------------ -------- ----- ------
COLOR SYSIBM DECIMAL 10 0 No
db2 alter table fruit alter column color set data type decimal(20)
Checking the results
db2 describe table fruit
Output:
Column Type Type
name schema name Length Scale Nulls
------------------------------ --------- ------------------ -------- ----- ------
COLOR SYSIBM DECIMAL 20 0 N
WARNING:
Don't forget to reorganize your table. The "Reorg recommended" column identifies the data type alterations that will require table reorganization before a table can again be fully accessed (SQLSTATE 57016)db2 reorg table fruit
db2 runstats on table fruit and indexes all