ITPub博客

首页 > 数据库 > Oracle > 查询schema下面所有表的行数

查询schema下面所有表的行数

原创 Oracle 作者:masheng0925 时间:2015-04-18 23:37:01 0 删除 编辑
declare
     cursor cur is select * from dba_objects where owner='TONY' and object_type='TABLE';
      tableinfo dba_objects%rowtype;
      sqltext varchar2(1000);
      tablenum number;
begin
      open cur;
      loop
           fetch cur into tabeinfo;
           exit when cur%notfound;
            sqltext:='select count(1) from :name into tablenum';
            execute immediate sqltext  using tableinfo.object_name;
            dbms_output.putline(tableinfo.object_name||'number is: || tablenum);
      end loop;
       close cur;
end;

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30201626/viewspace-1585243/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2015-04-11

  • 博文量
    43
  • 访问量
    44267