IT其它 数据库plsql

plsql怎么查询当前用户所有表和行数

plsql怎么查询当前用户所有表和行数

参与12

4 同行回答

guolf guolf 数据库管理员 sany
从统计信息里面查询可能不是很准,直接还是在库里面查实际行数比较准确,这样需要编辑语句。:1、生成要统计用户的SQL语句:select \'select \'\'\'||table_name||\'\'\', count(1) from \'||owner||\'.\'||table_name||\'  union\' from dba_tables where owner=\'替...显示全部

从统计信息里面查询可能不是很准,直接还是在库里面查实际行数比较准确,这样需要编辑语句。:

1、生成要统计用户的SQL语句:

select \'select \'\'\'||table_name||\'\'\', count(1) from \'||owner||\'.\'||table_name||\'  union\' from dba_tables where owner=\'替换成要统计的用户\';

2、生成脚本再套一层,例如:

select * from (

select \'DEPT\', count(1) from SCOTT.DEPT union

select \'EMP\', count(1) from SCOTT.EMP union

select \'SALGRADE\', count(1) from SCOTT.SALGRADE union

select \'BONUS\', count(1) from SCOTT.BONUS

)

收起
硬件生产 · 2016-03-08
浏览6448

提问者

jinhuaxj
其它 无公司
评论2

相关问题

相关资料

相关文章

问题状态

  • 发布时间:2016-03-04
  • 关注会员:4 人
  • 问题浏览:10873
  • 最近回答:2016-03-08
  • X社区推广