![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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 |
#3
| |||
| |||
|
|
On Nov 6, 1:14 pm, Ninja Li<nickli2... (AT) gmail (DOT) 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 |
#4
| |||
| |||
|
|
On Nov 6, 1:14*pm, Ninja Li <nickli2... (AT) gmail (DOT) com> wrote: * 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. 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. |
#5
| |||
| |||
|
|
ddf schreef: On Nov 6, 1:14 pm, Ninja Li<nickli2... (AT) gmail (DOT) 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 ..." ? * Itwon'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.- Hide quoted text - - Show quoted text - |
#6
| |||
| |||
|
|
It does work, and I've learned something new: |
#7
| |||
| |||
|
|
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 |
#8
| |||
| |||
|
|
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. HTH -- Mark D Powell -- |
#9
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |