Home > Database > Oracle > body text

How to delete a view in oracle?

coldplay.xixi
Release: 2020-07-17 15:17:41
Original
8188 people have browsed it

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 视图名字
Copy after login

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;
/
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!