Re: Make columns read only

From: Mark D Powell <>
Date: Mon, 8 Nov 2010 10:56:29 -0800 (PST)
Message-ID: <>

On Nov 6, 12:14 pm, Ninja Li <> wrote:
> Hi,
>   I would like to make certain columns in an Oracle table read only to
> prevent anyone from updating the values in these columns. I can think
> of creating trigger to issue error message whenever update occurs.
>   Are there better ways to do that? Your suggestions are appreciated.
>   Nick Li

To add to what has already been suggested.

If you do not want certain columns in a table updated by most users then those users should not have update privilege on the table to begin with. You can use views and/or stored code to provide read access and update access.

Also on 10g+ you can restrict column access via virtual private database (VPD).

Combing VPD with views and stored procedures can do a lot to protect data.

If certain columns should never change after initial insert then an after update trigger could be used to stop the transaction if the update touched certain columns. A trigger could be username aware so as to allow the owner or production batch username to update the target columns.

HTH -- Mark D Powell -- Received on Mon Nov 08 2010 - 12:56:29 CST

Original text of this message