Ricardo Pinto
Ricardo Pinto

Reputation: 373

db2 for zos - prohibit changes in columns

I would like to ask if there is a way to prohibit programs to change data in certain columns, at db2 level.

The problem is that I have some programs that change data in a group of tables but now I must not change data in some columns and I would like to know if there is a way that db2 can make that restriction.

I could change all the programs but would like to know if there is an easier way to block changes in a column.

Upvotes: 0

Views: 55

Answers (2)

Michael
Michael

Reputation: 11

Another option is to create a view with a subset of the columns you need to update. It may be a little more complex in case you need to rebind your program(s)

Upvotes: 0

Mark Barinstein
Mark Barinstein

Reputation: 12339

You may create, let's say, BEFORE UPDATE OF COL1, ..., COLx trigger on this table with a SIGNAL statement inside.
Alternatively you may revoke the update privilege on this table from everyone and grant update on a subset of columns needed only.

Upvotes: 1

Related Questions