首页 >数据库 >mysql教程 >查询数据中所有表实际记录数

查询数据中所有表实际记录数

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB原创
2016-06-07 15:54:151102浏览

set serverout onset serveroutput on size 1000000declarev_tab_name varchar2(100);cursor empCur is select table_name from user_tables;n_lows number;v_sql varchar2(1000);begin open empCur; loop fetch empCur into v_tab_name; v_sql:='select cou

set serverout on
set serveroutput on size 1000000
declare
v_tab_name varchar2(100);
cursor empCur is  select table_name from user_tables;
n_lows number;
v_sql varchar2(1000);
begin
  open empCur;
  
   loop
    fetch empCur into v_tab_name;
    v_sql:='select count(1) from '||v_tab_name;
    execute immediate v_sql into n_lows;
    exit when empCur%notfound; 
     DBMS_OUTPUT.PUT_LINE(v_tab_name||','||n_lows);
   end loop;
    commit;
  close empCur; 
end;

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn