oracle表空间中空表统计方法示例介绍

前端之家收集整理的这篇文章主要介绍了oracle表空间中空表统计方法示例介绍前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

<div class="codetitle"><a style="CURSOR: pointer" data="70106" class="copybut" id="copybut70106" onclick="doCopy('code70106')"> 代码如下:

<div class="codebody" id="code70106">
DECLARE
v_table tabs.tablename%TYPE;
v
sql VARCHAR2(888);
v_q NUMBER;
CURSOR c1 IS
SELECT table_name tn FROM tabs;
TYPE c IS REF CURSOR;
c2 c;
BEGIN
DBMS_OUTPUT.PUT_LINE('以下为空数据表的表名:');
FOR r1 IN c1 LOOP
vtable :=r1.tn;
v
sql :='SELECT COUNT(*) q FROM '||vtable;
OPEN c2 FOR v
sql;
LOOP
FETCH c2 INTO v_q;
EXIT WHEN c2%NOTFOUND;
IF v_q=0 THEN
DBMS_OUTPUT.PUT_LINE(v_table);
END IF;
END LOOP;
CLOSE c2;
END LOOP;
EXCEPTION
WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE('Error occurred');
END;

原文链接:https://www.f2er.com/oracle/65368.html

猜你在找的Oracle相关文章