String sql = "
select c.BRANCH_CODE || '-' || a.RES_DETAIL_NAME as BRANCH_CODE_NAME,
dic7.member_value || '-' || dic7.member_text as COUNTRY_NAME,
dic38.member_value || '-' || dic38.member_text as WWIC_NAME,
dic11.member_value || '-' || dic11.member_text as LEGAL_STATUS_NAME,
dic15.member_value || '-' || dic15.member_text as RESIDENT_CODE_NAME,
dic12.member_value || '-' || dic12.member_text as PROF_BUSINESS_NAME,
dic16.member_value || '-' || dic16.member_text as GROUP_CODE_NAME,
dic13.member_value || '-' || dic13.member_text as ADVISOR_CODE_NAME,
dic14.member_value || '-' || dic14.member_text as COUNTRY_CODE_NAME,
dic18.member_value || '-' || dic18.member_text as KWG_REP_INDICATOR_NAME,
dic21.member_value || '-' || dic21.member_text as HO_PROF_BUSINESS_CODE_NAME,
dic19.member_value || '-' || dic19.member_text as BANK_CODE_NAME,
dic23.member_value || '-' || dic23.member_text as MNC_CODE_NAME,
dic24.member_value || '-' || dic24.member_text as OWNERSHIP_OF_MNC_NAME,
dic25.member_value || '-' || dic25.member_text as SIZE_CLASSIFICATION_NAME,
dic53.member_value || '-' || dic53.member_text as PRIMARY_CUSTOMER_NAME,
c.*
from ci_idms_basic_master_cmp_log c
left join (select distinct t.RES_DETAIL_VALUE, t.RES_DETAIL_NAME
from view_ci_auth_role_resource t
where role_id in (select role_id
from view_ci_auth_role_user
where user_id = 'admin')
and t.RES_ID = '53') a on a.RES_DETAIL_VALUE =
c.branch_code
left join ci_sys_sov_member dic7 on c.COUNTRY = dic7.member_value
and dic7.group_code = 'IX_COUNTRY'
and dic7.sys_type = 'IDMS'
and dic7.branch_code = '0912'
left join ci_sys_sov_member dic38 on c.WWIC = dic38.member_value
and dic38.group_code = 'IX_WWIC'
and dic38.sys_type = 'IDMS'
and dic38.branch_code = '0912'
left join ci_sys_sov_member dic11 on c.LEGAL_STATUS = dic11.member_value
and dic11.group_code =
'IX_LEGAL_STATUS'
and dic11.sys_type = 'IDMS'
and dic11.branch_code = '0912'
left join ci_sys_sov_member dic15 on c.RESIDENT_CODE =
dic15.member_value
and dic15.group_code =
'IX_RESIDENT_CODE'
and dic15.sys_type = 'IDMS'
and dic15.branch_code = '0912'
left join ci_sys_sov_member dic12 on c.PROF_BUSINESS =
dic12.member_value
and dic12.group_code =
'IX_PROF_BUSINESS'
and dic12.sys_type = 'IDMS'
and dic12.branch_code = '0912'
left join ci_sys_sov_member dic16 on c.GROUP_CODE = dic16.member_value
and dic16.group_code = 'IX_GROUP_CODE'
and dic16.sys_type = 'IDMS'