Hi Pragya,
This is one another query I had but I havent tested this on Oracle, in case you are still interested.
select usr.id User_id,usr.user_name User_name,(case when usr.is_ldap=1 then 'LDAP' else 'NOT LDAP' END) as is_ldap,grp.group_name Group_Name,
vw.global_right Right_name,obs.BU_Group Dept,dim.res_obs as RES_OBS
from cmn_sec_user_groups usrgrp join cmn_sec_users usr on usr.id=usrgrp.user_id
join niku.CMN_SEC_GROUPS_V grp on grp.id =usrgrp.group_id
join (select a.group_name group_name,b.group_name Global_Right
from (select * from niku.CMN_SEC_GROUPS_V where language_code='en' and group_role_type='GROUP' and is_active=1 and right_type is null )a,
(select * from niku.CMN_SEC_GROUPS_V where language_code='en' and group_role_type='ROLE' and is_active=1 and right_type='System')b,
niku.CMN_SEC_GROUP_HIERARCHIES h where h.parent_group_id=a.id and h.group_id=b.id ) vw on vw.group_name=grp.group_name
left outer join (select USR.id user_id,srm.unique_name,OBS.LEVEL2_NAME as BU_Group,OBS.PATH BU_PATH from
SRM_RESOURCES SRM
JOIN CMN_SEC_USERS USR ON USR.ID = SRM.USER_ID
LEFT OUTER JOIN
PRJ_OBS_ASSOCIATIONS *** ON ***.RECORD_ID = SRM.ID AND TABLE_NAME='SRM_RESOURCES'
LEFT OUTER JOIN
PRJ_OBS_UNITS UNI ON UNI.ID = ***.UNIT_ID and type_id = (SELECT id from prj_obs_types where unique_name='amd_depts')
JOIN
NBI_DIM_OBS OBS ON OBS.OBS_UNIT_ID = UNI.ID) obs on obs.user_id=usr.id and obs.user_id=usrgrp.user_id
left outer join (select srm.user_id usrid,***.record_id res_id,dim.path res_obs from nbi_dim_obs dim,prj_obs_units uni,prj_obs_associations ***,srm_resources srm
where dim.obs_type_name='AMD HR Reporting Structure' and dim.obs_unit_id=uni.id and ***.unit_id=uni.id and srm.id = ***.record_id) dim on dim.usrid=usr.id
where grp.language_code='en'
and grp.group_role_type='GROUP' and grp.is_active=1 and grp.right_type is null
UNION
SELECT AR.PRINCIPAL_ID User_id,
(SELECT USER_NAME FROM CMN_SEC_USERS WHERE ID=AR.PRINCIPAL_ID) User_name,
(SELECT (case when is_ldap=1 then 'LDAP' else 'NOT LDAP' END) FROM CMN_SEC_USERS WHERE ID=AR.PRINCIPAL_ID)
as is_ldap,
'' Group_Name, G.GROUP_NAME Right_name ,
obs.BU_Group Dept,dim.res_obs as RES_OBS
FROM CMN_SEC_GROUPS_V G,
CMN_SEC_ASSGND_RIGHT AR,
CMN_SEC_USERS CMN ,
(select USR.id user_id,srm.unique_name,OBS.LEVEL2_NAME as BU_Group,OBS.PATH BU_PATH from
SRM_RESOURCES SRM
JOIN CMN_SEC_USERS USR ON USR.ID = SRM.USER_ID
LEFT OUTER JOIN
PRJ_OBS_ASSOCIATIONS *** ON ***.RECORD_ID = SRM.ID AND TABLE_NAME='SRM_RESOURCES'
LEFT OUTER JOIN
PRJ_OBS_UNITS UNI ON UNI.ID = ***.UNIT_ID and type_id = (SELECT id from prj_obs_types where unique_name='amd_depts')
JOIN
NBI_DIM_OBS OBS ON OBS.OBS_UNIT_ID = UNI.ID) obs ,
(select srm.user_id usrid,***.record_id res_id,dim.path res_obs from nbi_dim_obs dim,prj_obs_units uni,prj_obs_associations ***,srm_resources srm
where dim.obs_type_name='AMD HR Reporting Structure' and dim.obs_unit_id=uni.id and ***.unit_id=uni.id and srm.id = ***.record_id) dim
WHERE AR.PRINCIPAL_ID = CMN.ID
and obs.user_id=cmn.id
AND AR.PRINCIPAL_TYPE = 'USER' AND AR.INSTANCE_TYPE = 'SYSTEM'
and dim.usrid=cmn.id
AND G.LANGUAGE_CODE= 'en' AND AR.RIGHT_ID = G.ID AND (G.IS_AUTOMATIC != 1 OR G.IS_AUTOMATIC IS NULL) AND G.RIGHT_TYPE IS NOT NULL AND G.IS_ACTIVE = 1
order by usr.user_name,grp.group_name
Thanks,
Jerin