The DB2 database supports the keyword ALLOCATE for fields with variable length. I would like to use it in the column definition in table creation.
The problem is that the default value is 0 which means the full field is allocated. So VARCHAR(30) uses more memory as CHAR(30), because it stores full length CHAR and the length value.
We use custom SQL to alter the table. Meaning we have two places that must be looked at.
Example use could be:
<column name="MYCOLUMN" type="NVARCHAR(70)" defaultValue="" remarks="My variable length field">
<constraints nullable="false" allocate="30" />
DB2 on IBM i