DECLARE
v_owner varchar2(40);
v_table_name varchar2(40);
cursor get_tables is
select distinct table_name
from total_tables
where is_insert = 1;
begin
open get_tables;
loop
fetch get_tables into v_table_name;
EXIT WHEN get_tables%NOTFOUND;
execute immediate 'INSERT INTO table_count(TABLE_NAME,count_number)
SELECT ''' || v_table_name || ''' , COUNT(*) FROM ' || v_table_name;
end loop;
CLOSE get_tables;
END;
insert into total_tables_cba(table_name)
select table_name from all_tables where owner='LURLIVE'
CREATE TABLE total_tables_cba_COUNT_total (
table_name VARCHAR2(100) NOT NULL,
record_count NUMBER NULL
);
select * from total_tables_cba
insert into total_tables_cba(table_name)
select * from total_tables_cba
select * from total_tables_cba_COUNT_total
delete from total_tables_cba_COUNT_total
DECLARE
v_owner varchar2(40);
v_table_name varchar2(40);
cursor get_tables is
select table_name
from total_tables_cba
where is_insert = 2;
begin
open get_tables;
loop
fetch get_tables into v_table_name;
EXIT WHEN get_tables%NOTFOUND;
execute immediate 'INSERT INTO total_tables_cba_COUNT_total(TABLE_NAME,record_count)
SELECT ''' || v_table_name || ''' , COUNT(*) FROM ' || v_table_name;
end loop;
CLOSE get_tables;
END;
No comments:
Post a Comment