Search code examples
db2-zos

Generated column doesn't work for z/os while it is ok in LUW


The following DDL is valid for LUW.

CREATE TABLE three_a(
    c1   INTEGER NOT NULL,
    c2   INTEGER NOT NULL GENERATED ALWAYS AS c1 + 10
)

But it is NOT valid for z/OS:

Any idea how to implement GENERATED ALWAYS to use it like computed columns in SQL Server?


Solution

  • It is not implemented in the Z/OS version. You can find the allowable various options for "default" in the SQL manual under the "create table" SQL statement. There is an option to define a fieldproc on a column but it will not be (and do) what you want (more on it in the administration guide).