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性能调优” 博客,请务必保留此出处http://5073392.blog.51cto.com/5063392/1539276