首先建立一个计算函数
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
create or replace function count_rows(table_name in varchar2,
owner in varchar2 default null)
return number
authid current_user
IS
num_rows number;
stmt varchar2(2000);
begin
if owner is null then
stmt := 'select count(*) from "'||table_name||'"';
else
stmt := 'select count(*) from "'||owner||'"."'||table_name||'"';
end if;
execute immediate stmt into num_rows;
return num_rows;
end;
然后通过计算函数进行统计
select table_name, count_rows(table_name) nrows from user_tables
Oracle查询数据库中所有表的记录数
原创文章标签 oracle 数据库 表 记录数 统计 文章分类 数据库
©著作权归作者所有:来自51CTO博客作者pizibaidu的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
flex显示数据库表中的所有数据
------------
远程对象 Flex BlazeDS java web -
oracle数据库、表空间、所有对像的关系
看三思笔记中,有一图比较直观:(收藏了)
oracle 数据库