WITH USER_OBJECTS
AS (SELECT U.NAME AS OWNER
, O.NAME AS OBJ_NAME
, DECODE ( O.TYPE#
, 1, 'INDEX'
, 2, 'TABLE'
, 3, 'CLUSTER'
, 4, 'VIEW'
, 5, 'SYNONYM'
, 6, 'SEQUENCE'
, 7, 'PROCEDURE'
, 8, 'FUNCTION'
, 9, 'PACKAGE'
, 12, 'TRIGGER'
, 13, 'TYPE'
, 22, 'LIBRARY'
, 23, 'DIRECTORY'
, 24, 'QUEUE'
, 28, 'JAVA SOURCE'
, 29, 'JAVA CLASS'
, 30, 'JAVA RESOURCE'
, 32, 'INDEXTYPE'
, 33, 'OPERATOR'
, 42, 'MATERIALIZED VIEW'
, 'UNDEFINED') AS OBJ_TYPE
, O.TYPE#
FROM SYS.OBJ$ O
JOIN SYS.USER$ U ON O.OWNER# = U.USER#
WHERE U.NAME = 'ESS')
SELECT OBJ_TYPE
, COUNT(*)
FROM USER_OBJECTS
GROUP BY OBJ_TYPE;