Oralce queries all empty tables _

Source: Internet
Author: User

Oralce queries all empty tables _
1. Analysis

There are three key points:

USER_TABLES (TABS) Underline for fuzzy query _ processing ORACLE-ANALYZE

1.1.USER _ TABLES (TABS)

USER_TABLES (TABS): views of all tables of the current user.

The figure contains the table name (TABLE_NAME), number of records (NUM_ROWS), and other information.

For example, to query all the table names and records under the current user:

Select TABLE_NAME, NUM_ROWS from tabs;
1. 2. Underline _ processing of fuzzy queries

In the fuzzy query of Oralce, _ cannot be used as an underline for matching.

Because _ identifies any character in fuzzy match.

Escape using the escape keyword.

For example, to query all tables starting with AB:

Analyze table table_name compute statistics for table;
2. Write SQL

1. analyze all qualified tables

Select 'analyze table' | t. TABLE_NAME | 'compute statistics for table; 'from user_tables t where t. TABLE_NAME like' AB \ _ % 'escape '\';

2. Perform ORACLE-ANALYZE

Place the execution result of the preceding SQL statement in the Command window for execution.

3. Write and execute query statements

Select t. TABLE_NAME, t. NUM_ROWS from tabs t where t. NUM_ROWS = 0 and t. TABLE_NAME like 'AB \ _ % 'escape' \ 'and t. NUM_ROWS = 0;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.