In the Oracle database, find the empty table without DECLAREv_tabletabs.table_name % TYPE; v_sqlVARCHAR2 (888); v_qNUMBER; struct; TYPEcISREFCURSOR; C2C; partition (the table name of the empty data table is as follows:); FORr1INc1LOOP
In the Oracle database, find the empty table without DECLARE v_table tabs. table_name % 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 ('table name of the empty data table below: '); FOR r1 IN c1 LOOP
Empty table identification in Oracle Database <无>
DECLARE v_table tabs. table_name % 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 ('table name of the empty data table below: '); FOR r1 IN c1 LOOP v_table: = r1.tn; v_ SQL: = 'select COUNT (*) q from' | v_table; 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;
SELECT * FROM dba_segments WHERE blocks <= 1 AND segment_type = 'TABLE';