Oracle 查询数据库表(查看当前用户下的表)的数量
SELECT count(*)
FROM sys.user_tables;
统计表中记录数量
第一步:新增count_rows 函数
CREATE OR REPLACE FUNCTION count_rows (
table_name IN varchar2,
owner IN varchar2 := NULL
)
RETURN number AUTHID current_user
AS
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;
第二步:调用count_rows 函数,统计各种表的记录数
select table_name, count_rows(table_name) nrows from user_tables
order by nrows desc;
————————————————
链接:https://blog.csdn.net/zhouzhiwengang/article/details/110862492
标签:count,rows,name,stmt,num,查询数据库,Oracle,table,数量 From: https://www.cnblogs.com/emanlee/p/17419694.html