Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Return table name and record count
Hello Group,
I was trying to write a script that returns the name of my tables and
the number of records in each table. This is as close as I can get but
keep getting a "PLS-00201: identifier 'TAB_NAME' must be declared"
error. Am I making this more complicated than necessary?
Thanks
declare
tab_name USER_TABLES.TABLE_NAME%TYPE; rec_count number; err_mssg varchar2(512);
tab_name := tab_rec.table_name; select count(*) into rec_count from tab_name; dbms_output.put_line(tab_name||','||rec_count);end loop;
when others then err_mssg :=sqlerrm; dbms_output.put_line(err_mssg);