I understand that database views are read-only, or at least read-only by default.
我知道数据库视图是只读的,或者至少是默认的只读。
Is it possible to enable the change of data brought by an oracle view?
是否可以启用oracle视图带来的数据更改?
Rephrasing: If I make a view of just one table, just to hide some columns, will changes to this data be updated on the table?
改述:如果我只查看一个表,只是为了隐藏一些列,这些数据的更改是否会在表上更新?
3 个解决方案
#1
Yes, Oracle views can be modified.
是的,可以修改Oracle视图。
There are, however, some restrictions:
但是,有一些限制:
- views that contain set operators, aggregates, GROUP BY, DISTINCT and joins (in general) are not modifiable
- only some join views are modifiable
包含集合运算符,聚合,GROUP BY,DISTINCT和连接(通常)的视图不可修改
只有一些连接视图是可修改的
#2
I don't believe Oracle views are read only by default... a single table view should be updateable providing it doesn't contain multiple row operations like DISTINCT or GROUP BY. The user in question must have been granted UPDATE VIEW privs.
我不认为默认情况下只读取Oracle视图...单个表视图应该是可更新的,前提是它不包含多行操作,如DISTINCT或GROUP BY。有问题的用户必须已被授予UPDATE VIEW privs。
A simple view with columns removed should definitely be updatable proividing you have privs to update the view in question...
删除列的简单视图肯定是可更新的,可以让您有权更新有问题的视图...
GRANT UPDATE ON your_view_name TO your_user;
What error(s) are you getting when you try to run the UPDATE statement?
当您尝试运行UPDATE语句时,您得到了什么错误?
#3
In oracle a view contains no base data of it's own. So if your view allows updates then the underlying table will be updated.
在oracle中,视图不包含它自己的基础数据。因此,如果您的视图允许更新,那么将更新基础表。
If you need more information it is worth looking at the "views" section in the Oracle concepts guide.
如果您需要更多信息,请查看Oracle概念指南中的“视图”部分。
http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/schema.htm#sthref787
Further information can also be found in the "Create View" sql command.
更多信息也可以在“Create View”sql命令中找到。
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_8004.htm#SQLRF01504
Hope this helps
希望这可以帮助
Regards
#1
Yes, Oracle views can be modified.
是的,可以修改Oracle视图。
There are, however, some restrictions:
但是,有一些限制:
- views that contain set operators, aggregates, GROUP BY, DISTINCT and joins (in general) are not modifiable
- only some join views are modifiable
包含集合运算符,聚合,GROUP BY,DISTINCT和连接(通常)的视图不可修改
只有一些连接视图是可修改的
#2
I don't believe Oracle views are read only by default... a single table view should be updateable providing it doesn't contain multiple row operations like DISTINCT or GROUP BY. The user in question must have been granted UPDATE VIEW privs.
我不认为默认情况下只读取Oracle视图...单个表视图应该是可更新的,前提是它不包含多行操作,如DISTINCT或GROUP BY。有问题的用户必须已被授予UPDATE VIEW privs。
A simple view with columns removed should definitely be updatable proividing you have privs to update the view in question...
删除列的简单视图肯定是可更新的,可以让您有权更新有问题的视图...
GRANT UPDATE ON your_view_name TO your_user;
What error(s) are you getting when you try to run the UPDATE statement?
当您尝试运行UPDATE语句时,您得到了什么错误?
#3
In oracle a view contains no base data of it's own. So if your view allows updates then the underlying table will be updated.
在oracle中,视图不包含它自己的基础数据。因此,如果您的视图允许更新,那么将更新基础表。
If you need more information it is worth looking at the "views" section in the Oracle concepts guide.
如果您需要更多信息,请查看Oracle概念指南中的“视图”部分。
http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/schema.htm#sthref787
Further information can also be found in the "Create View" sql command.
更多信息也可以在“Create View”sql命令中找到。
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_8004.htm#SQLRF01504
Hope this helps
希望这可以帮助
Regards