I'd like to define a custom field type, MYTYPE, that is calculated according to a formula (e.g. FIELD1+FIELD2). I'd like to be able to add fields of MYTYPE to DB2 database tables.
Oracle refers to this ability as virtual column. More info can be found here:
I am not sure if DB2 views can achieve the same purpose. Views can define a column for the calculated fields, but may not allow associating the calculation with a custom type. Having a custom type is important because it allows keeping the formula definition in a single place and seemlessly propagate the updates.