SELECT COUNT(*)
FROM SYS.OBJ$ O, SYS.USER$ U
WHERE U.NAME = 'DEMO2'
AND U.USER# = O.OWNER#
AND O.NAME = 'TEST1'
AND O.TYPE# = 2
AND EXISTS(SELECT 1
FROM SYS.USER$
WHERE NAME = 'DEMO'
AND TYPE# = 1)