oracle8.1.6 select q.user_id from (select user_id from users where acs_permission.permission_p(:context_root_id, user_id, 'admin') = 't') q where rownum = 1 select q.* from (select u.user_id aa.authority_id, u.username from users u, auth_authorities aa where u.authority_id = aa.authority_id and aa.short_name = 'local') q where rownum = 1