Quote:
Originally posted by puneet
I am trying to run a PL/SQL to get the table_name , num_rows from user_tables and count(*) for each table and if the difference between num _rows and count(*) for that table is greater than 10000 then I want to display it .
declare
tab varchar2(100);
a number;
b = 2 number ;
c number
begin
loop
b:= b +1;
SELECT table_name into tab FROM user_tables where rownum < a;
SELECT NUM_ROWS INTO b FROM USER_TABLES WHERE TABLE_NAME = 'tab';
select count(*) into c from 'tab';
if b - c > 10000 then
dbms_output.put_line ('tab' , b , c );
exit when b = 30;
end loop;
end;
/
Please let me know what is wrong with this .
Thanks
Let's start with...everything?! Not to be destructive, but I can not correlate what you say you're trying to do with what that code is doing whatsoever.