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.