Home > Database > Oracle > body text

How to delete all tables under a user in oracle?

青灯夜游
Release: 2020-08-22 13:27:52
Original
4288 people have browsed it

Method: Use "SELECT 'DELETE FROM '|| table_name || ';' FROM USER_TABLES ORDER BY TABLE_NAME;" to query; copy the query results and execute it again in the sql command window to delete all surface.

How to delete all tables under a user in oracle?

Delete all tables under a user in Oracle

General method:

First use sql query:

SELECT 'DELETE FROM '|| table_name || ';' FROM USER_TABLES ORDER BY TABLE_NAME;
Copy after login

Copy the query results and execute it again in the sql command window to delete all tables.

There is also a more comprehensive deletion:

Similar to the previous one, first use sql query:

select 'drop table '||table_name||';' from cat where table_type='TABLE' ORDER BY TABLE_NAME;
Copy after login

This query is the cat table , the number of query results will be greater than the previous one, because it contains tables starting with BIN$. There will be residues after deleting the tables in Oracle. If you want to delete these remaining tables, you must enter this query sql, and then Like the previous method

copy the query results and execute it again in the sql command window to delete all tables.

Recommended tutorial: "Oracle Tutorial"

The above is the detailed content of How to delete all tables under a user 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