Uzyskaj liczby wszystkich tabel w schemacie
Próbuję uzyskać liczbę rekordów wszystkich tabel w schemacie. Mam problem z zapisaniem PL / SQL. Oto co zrobiłem do tej pory, ale dostaję błędy. Zaproponuj wszelkie zmiany:
DECLARE
v_owner varchar2(40);
v_table_name varchar2(40);
cursor get_tables is
select distinct table_name,user
from user_tables
where lower(user) = 'SCHEMA_NAME';
begin
open get_tables;
fetch get_tables into v_table_name,v_owner;
INSERT INTO STATS_TABLE(TABLE_NAME,SCHEMA_NAME,RECORD_COUNT,CREATED)
SELECT v_table_name,v_owner,COUNT(*),TO_DATE(SYSDATE,'DD-MON-YY') FROM v_table_name;
CLOSE get_tables;
END;