If the privilege has been granted directly or to a role, the grant will appear in
SELECT grantee, privilege
WHERE owner = 'B'
AND table_name = 'MYPACKAGE'
AND privilege = 'EXECUTE'
grantee is a role, you would then need to look at
dba_role_privs to see what users (or roles) have been granted that role and follow the chain if you have roles granted to other roles. If you need to account for users that have grants because of the (very dangerous)
ANY grants (i.e.
EXECUTE ANY PROCEDURE), that would require a separate query.
If you want to get more sophisticated than simply doing a straight query against
dba_tab_privs, though, you are probably better off using on of Pete Finnigan's scripts like the
who_has_priv_procedure.sql). Pete is probably the leading expert on Oracle security so these are much more likely to account for every possible corner case than anything I would attempt to cobble together.