Home >Database >Oracle >How to delete a view in oracle?

How to delete a view in oracle?

coldplay.xixi
coldplay.xixiOriginal
2020-07-17 15:17:418241browse

How to delete a view in oracle: first log in with the user who created the view; then use DROP VIEW to delete the view, the code is [execute immediately 'drop view '||dao cur.view_name ||';';].

How to delete a view in oracle?

Oracle method to delete a view:

What kind of view data can use DELETE?

Only views imported from a single table are allowed. Such view operations are actually equivalent to operating tables, but DROP VIEW will not have any impact on the data. It is impossible to delete data in other forms of views. But DROP VIEW can also be used.

The statement to delete the view is:

DROP VIEW 视图名字

So deleting the view will not have any impact on the data. Because the data is in the table. If you want to restore the view and recreate it, your tens of millions of data will appear again. The effect of the view is the same as the SELECT query, except that the query can be fixed so that you can use it directly.

Log in as the user who created the view and execute the following code to delete all views, but be careful.

The premise is that the user has the permission to execute code.

begin
for cur in (select view_name from user_views) loop
execute immediately 'drop view '||dao cur.view_name ||';';
end loop;
end;
/

Related learning recommendations: oracle database learning tutorial

The above is the detailed content of How to delete a view in oracle?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Related articles

See more