Bruger ikke ligefrem COUNT(), men NUM_ROWS burde gøre:
CREATE OR REPLACE PROCEDURE GET_TABLE_COUNT4(TABLE_NAME IN VARCHAR2,
SCHEMA_NAME IN VARCHAR2) IS
TABLE_COUNT NUMBER;
BYTE_COUNT NUMBER;
BEGIN
SELECT DB.NUM_ROWS
INTO TABLE_COUNT
FROM DBA_TABLES DB
WHERE DB.TABLE_NAME = UPPER(TABLE_NAME);
DBMS_OUTPUT.PUT_LINE(TABLE_COUNT);
SELECT BYTES
INTO BYTE_COUNT
FROM DBA_SEGMENTS
WHERE OWNER = UPPER(SCHEMA_NAME)
AND SEGMENT_NAME = UPPER(TABLE_NAME);
DBMS_OUTPUT.PUT_LINE(BYTE_COUNT);
END;
/