查询某个用户下各个表的数据量

CREATE OR REPLACE FUNCTION sql_excute(v_sql IN VARCHAR2)
  RETURN VARCHAR2 IS
  v_result VARCHAR2(1000);
BEGIN
  IF v_sql IS NULL THEN
    RETURN '';
  ELSE
     begin
    execute immediate v_sql into v_result;
    exception
      when others then
      v_result :='0';
      end;

  END IF;

  RETURN(v_result);

END sql_excute;
   select  TABLE_NAME , sql_excute('select count(*) from ' || t.TABLE_NAME) as count
 from dba_tables t where t.OWNER='CREDITFW' 

posted @ 2020-05-19 09:48  迷途的小码农  阅读(1138)  评论(0编辑  收藏  举报