Non sono sicuro di quale sia il requisito esatto qui, ma puoi utilizzare il seguente approccio per recuperare il numero di record da ciascuna tabella.
SQL> -- This is sample data
SQL> WITH SAMPLE_DATA(TNAME) AS
2 (SELECT 'CUSTOMERS' FROM DUAL UNION ALL
3 SELECT 'INTERVAL_TAB' FROM DUAL)
4 -- Your query starts from here
5 SELECT TABLE_NAME,
6 TO_NUMBER(
7 EXTRACTVALUE( XMLTYPE(
8 DBMS_XMLGEN.GETXML('select count(*) c from ' || U.TABLE_NAME)
9 ), '/ROWSET/ROW/C')) COUNT
10 FROM USER_TABLES U JOIN SAMPLE_DATA S ON S.TNAME = U.TABLE_NAME;
TABLE_NAME COUNT
--------------- ----------
CUSTOMERS 1
INTERVAL_TAB 0
SQL>
-- Aggiorna
Puoi generare la vista come segue:
-- AGGIORNATA QUESTA SEZIONE
CREATE OR REPLACE VIEW V_CHECK_RECORDS_AUS AS
SELECT TABLE_NAME,
TO_NUMBER(
EXTRACTVALUE( XMLTYPE(
DBMS_XMLGEN.GETXML('select count(*) c from '
|| U.TABLE_NAME || ' WHERE oe_name=''BUL''')
), '/ROWSET/ROW/C')) NUM_ROWS
FROM USER_TAB_COLUMNS U JOIN GD_TABLE_ORDER S ON S.TABLE_NAME_AUS = U.TABLE_NAME
WHERE U.COLUMN_NAME = 'OE_NAME';
Allo stesso modo puoi generare altre viste.
-- Ulteriore aggiornamento
CREATE OR REPLACE VIEW V_CHECK_RECORDS_AUS AS
SELECT TABLE_NAME,
CASE WHEN U.COLUMN_NAME IS NOT NULL THEN TO_NUMBER(
EXTRACTVALUE( XMLTYPE(
DBMS_XMLGEN.GETXML('select count(*) c from '
|| U.TABLE_NAME || ' WHERE ' || U.COLUMN_NAME || '=''BUL''')
), '/ROWSET/ROW/C'))
ELSE 0 END NUM_ROWS
FROM GD_TABLE_ORDER S LEFT JOIN USER_TAB_COLUMNS U
ON S.TABLE_NAME_AUS = U.TABLE_NAME AND U.COLUMN_NAME = 'OE_NAME';