DECLARE CURSOR c1 is select table_name from user_tables; V_TABLE_NAME user_tables.TABLE_NAME%TYPE; V_CNT number; V_SQL varchar2(2000); BEGIN FOR V_TABLE_NAME in c1 loop V_SQL := ‘select count(1) from ‘ || V_TABLE_NAME.table_name; execute immediate V_SQL into V_CNT; dbms_output.put_line( V_TABLE_NAME.table_name || ‘,‘ || V_CNT); end loop; end;
Oracle统计用户所有表的行数
时间: 2024-10-08 19:26:55