1.查询库中的表名和表中记录数:
SELECT T.TABLE_NAME, T.NUM_ROWS FROM USER_TABLES T;

2.查询库中记录总数:
SELECT SUM(A.NUM_ROWS) FROM (SELECT T.TABLE_NAME, T.NUM_ROWS FROM USER_TABLES T) A;

3.查询某个用户下所有表记录总数
SELECT SUM(A.NUM_ROWS) FROM (
SELECT T.TABLE_NAME, T.NUM_ROWS FROM USER_TABLES T where T.TABLE_NAME in ( Select distinct a.Table_Name
From Sys.All_Tab_Columns a,
Sys.Dba_Col_Comments b,
Sys.All_Tab_Comments c
Where a.Owner = b.Owner
And a.Table_Name = b.Table_Name
And a.Table_Name = c.Table_Name
And a.Column_Name = b.Column_Name
And a.Owner = ‘GAS_SCYX_BASE’ --用户
)) A;

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐