The Oracle statement queries the table names on the database, iterates through the query results, and gets each field in the result of each table name.

Source: Internet
Author: User

The execution environment of a statement is a SQL window of Plsql, which is intended to determine the number of records not equal to a field from all tables in the entire database.

The code is as follows:

DECLARE S_sql clob:= "; --Declares a variable that is used to store the SQL statement of the query

V_citycode varchar2 (20); --Each SQL statement executes the query result code VARCHAR2 (20);     --Query condition Begin--Open transaction code: = ' 110112 '; For WF in (select table_name from user_tables where table_name like ' __________________201711% ')--a fuzzy query for table names from all tables in the database, and then Iterate through each table name loop--Loop body s_sql:= ' SELECT COUNT (*) from ' | | wf.table_name| | ' where City_code!=:1 '; --Combine query statements, where City_code! =: 1 is used with code (using code below), 1 does not actually make sense to execute immediate s_sql into v_citycode using cod e;--performing Dynamic SQL Dbms_output.put_line (v_citycode| | ' ' | | Wf.table_name);  -Output end loop; End


The Oracle statement queries the table names on the database, iterates through the query results, and gets each field in the result of each table name.

Related Article

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.