tags:

views:

503

answers:

4

Hello,

Is it possible to 'hide' a column in an Oracle 10g database, or prevent data from being inserted altogether? We'd prefer to have existing INSERT statements still function, but have the information NOT insert for a particular column. Also, column masking or any type of encryption is not preferred.

Not sure if it's possible, but thanks in advance.

+2  A: 

With Oracle feature virtual private database (VPD) you can define which users can change and which users can select a column. Virtual private database is also called fine-grained access control (FGAC).

tuinstoel
+3  A: 

If all you need to do is stop data from being inserted, you could create a BEFORE INSERT FOR EACH ROW trigger that wipes out any value inserted into the column before the row is saved.

There are various other things you can do with security (also views) to prevent inserts/selects from particular users in particular circumstances, but these will probably not let existing inserts continue to work.

Eric Rosenberger
This is most likely the route we would like to take... Do you know if the original INSERT event would be logged, or just the trigger event?Thanks!
Depends what you mean by "logged"... As far as the transaction log goes, it should only be a single INSERT with the values as modified by the trigger (i.e., there wouldn't be two entries), but I suppose a lower-level audit log or something might record the original version somewhere...
Eric Rosenberger
+1  A: 

Rename original table, create view with original table name but only selecting the columns you want to show.

Recompile code referring to existing table.

A: 

what about just setting your grants to each item you allow to update or insert

grant select on emp to scott;

grant update (column1, column2), insert (column1) on emp to scott

Mike A