简体   繁体   English

如何在Oracle中更新视图

[英]How to update a view in oracle

I have create view without any problem in Oracle. 我已经创建了视图,在Oracle中没有任何问题。 But I can not update it.I want update view in oracle, please help. 但是我无法更新它。我想在oracle中更新视图,请帮忙。 Is it possible anyway? 反正有可能吗?

You can create an instead of trigger on the view, as described in the documentation : 您可以在视图上创建一个触发器instead of触发器, 如文档中所述

A view presents the output of a query as a table. 视图将查询的输出显示为表格。 If you want to change a view as you would change a table, you must create INSTEAD OF triggers. 如果要像更改表一样更改视图,则必须创建INSTEAD OF触发器。 Instead of changing the view, they change the underlying tables. 他们没有更改视图,而是更改了基础表。

Once you have that trigger in place, you can update the view using the same syntax as if it was a table. 一旦有了该触发器,就可以使用与表一样的语法来更新视图。

You haven't shown your view or table definitions so there isn't enough information to provide a useful example; 您没有显示视图或表的定义,因此没有足够的信息来提供有用的示例。 fortunately the documentation has one you can use as a starting point. 幸运的是,文档中有一个您可以用作起点。

视图是我的朋友选择的表,在那里,如果要更新视图,则必须更新表,然后才能在视图中看到更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM