oracle统计用户下面所有的表,并显示每个表的行数

declare
  t_count   number(10);
  t_str VARCHAR2(500);
  cursor t_tables is select table_name from user_tables;
begin
  for t_row in t_tables loop
    t_str := 'select count(*) from '|| t_row.table_name;
    execute immediate t_str into t_count;
    dbms_output.put_line( t_row.table_name || '=' || to_char(t_count));
  end loop;
end;

posted @ 2015-06-15 21:26  __kylong  阅读(2445)  评论(0编辑  收藏  举报