Re: Make columns read only

From: Gerard H. Pille <ghp_at_skynet.be>
Date: Sat, 06 Nov 2010 23:22:11 +0100
Message-ID: <4cd5d429$0$14248$ba620e4c_at_news.skynet.be>



ddf schreef:
> On Nov 6, 1:14 pm, Ninja Li<nickli2..._at_gmail.com> 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
>
> I don't know of any; if you're using 10.2.0.x you could create a read-
> only materialized view and if you're using 11.2 you can make the table
> read only. Of course making the entire table or materialized view
> read only doesn't solve your problem and Oracle hasn't yet provided a
> way (through, say, the ALTER TABLE statement) to make selected columns
> read-only. It would appear that a before insert trigger is the only
> option you have.
>
>
> David Fitzjarrell

Or a "before update" ?

But why not "grant update (column1, column3) on my_table to ..." ? It won't stop the table owner from updating those columns, but I suppose he could disable the triggers too. I've never used it but it's in the manuals. Received on Sat Nov 06 2010 - 17:22:11 CDT

Original text of this message