I got a request to implement Column-level privileges, for example:
GRANT UPDATE("column1") ON "TABLE" TO ROLE;
But I found that client applications ( in Delphi+ODAC ) always emits SQL updates like:
update TABLE set column1=:column1,column2=:column2,column3=:column3,...etc
where id_c=:id_c;
what causes Oracle to always throw ORA-01031: insufficient privileges, even if only column1 was changed. The obvious solution is to change the client application so that it emits SQL updates only with changed columns, but it looks like quite a lot of coding.
Is there any more elegant solution possible?
Edit: I forgot to mention that there is considerable number of hardcoded insert/update queries in my Delphi sources. ODAC cannot help in this case.
You can create a view and an
INSTEAD OF UPDATEtrigger on that view:If you want to process a column only if its value had not changed, then you’ll have to write several
UPDATEstatements:This is far from being efficient, though.
In
Oracle, theUPDATEexecutes even if the actual value of the column does not change. This means that the row gets locked, triggers fire etc.