# Single Account Query cannot fetch '$(identity)'

**URL:** <https://developer.sailpoint.com/discuss/t/single-account-query-cannot-fetch-identity/87214>\
**Category:** SHF Discussion and Questions\
**Tags:** jdbc-connector, identity-security-cloud, provisioning, rules, aggregation\
**Created:** [October 28, 2024, 9:22pm UTC](https://developer.sailpoint.com/discuss/t/single-account-query-cannot-fetch-identity/87214 "2024-10-28T21:22:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pulatoi](https://avatars.discourse-cdn.com/v4/letter/p/c89c15/32.png) [@pulatoi](https://developer.sailpoint.com/discuss/u/pulatoi)\
**Post date:** [October 28, 2024, 9:22pm UTC](https://developer.sailpoint.com/discuss/t/single-account-query-cannot-fetch-identity/87214/1 "2024-10-28T21:22:38Z")

</div>

Hello everybody,  
I am working with JDBC connector, and faced an issue with a single account aggregation. The query for Single account is exactly the same as Account SQL Query, just added `WHERE e.emp_id = '$(identity)'`. The query is working in SQL Studio if I substitute e.emp\_id with an actual value, like:  
`WHERE e.emp_id = '777777'`  
I checked the logs, and thats what I am getting:  
 ![image](https://global.discourse-cdn.com/sailpoint/original/3X/1/1/11e63d35683ec1e349d43b483f867590662ac8af.png)

I will attach the whole sql query just in case:

```auto
SELECT e.emp_id, e.emp_login_nm, e.emp_title_id, e.emp_proc_grp_id, e.emp_sec_group_id, e.inactive_ind, e.emp_fname, e.emp_lname, e.emp_email, e.emp_phone, , e.emp_proc_id, e.emp_officer_id, e.appr_id, e.emp_officer_ind, e.emp_sys_user_yn, e.emp_new_user_yn, e.emp_external_yn, e.appr_g_role_type_id, e.emp_locale_id, e.emp_timezone_code, e.emp_deal_desicion_yn, e.emp_official_yn, case when e.inactive_ind IS NOT NULL then 'true' else 'false' end as IIQDisabled, t.pos_desc
,CASE WHEN emp_officer_id IS NOT NULL then 'isOfficer_Y'ELSE 'isOfficer_N' END AS isOfficer_YN, affs.lgl_ent_id, l2.lgl_ent_val, rl.code_desc, appr_rel.appr_g_id
FROM [emp] e 
LEFT JOIN [sec_group] sg ON e.emp_sec_group_id = sg.secg_id
LEFT JOIN [legal_ent] l ON e.emp_lgl_ent_id = l.lgl_ent_id
LEFT JOIN internal_position t ON e.emp_title_id = t.pos_id
LEFT JOIN process_group p ON e.emp_proc_grp_id = p.proc_grp_id
LEFT JOIn emp_affiliate_rel affs ON e.emp_id = affs.emp_id
LEFT JOIN legal_ent l2 on affs.lgl_ent_id = l2.lgl_ent_id
LEFT JOIN code rl on e.appr_g_role_type_id = rl.code_id
LEFT JOIN emp_appr_rel appr_rel on e.emp_id = appr_rel.emp_id
LEFT JOIN approval_matrix a on appr_rel.appr_g_id = a.appr_id
WHERE e.emp_id = '$(identity)'

```

Please help, thanks in advance!

---

<div class="post-metadata">

**Author:** ![pulatoi](https://avatars.discourse-cdn.com/v4/letter/p/c89c15/32.png) [@pulatoi](https://developer.sailpoint.com/discuss/u/pulatoi)\
**Post date:** [October 28, 2024, 9:23pm UTC](https://developer.sailpoint.com/discuss/t/single-account-query-cannot-fetch-identity/87214/2 "2024-10-28T21:23:33Z")

</div>

The picture was unclear, so essentially that is what I am getting:  
WHERE e.emp\_id = ?].

---

<div class="post-metadata">

**Author:** ![Santhakumar](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/santhakumar/32/17329_2.png) [@Santhakumar](https://developer.sailpoint.com/discuss/u/Santhakumar)\
**Post date:** [October 29, 2024, 6:11am UTC](https://developer.sailpoint.com/discuss/t/single-account-query-cannot-fetch-identity/87214/3 "2024-10-29T06:11:55Z")

</div>

@pulatoi can you try instead of WHERE e.emp\_id = ‘$(identity)’ to WHERE e.emp\_id = ‘$getObject.nativeIdentity’. LMK if it works.

Thanks  
Shantha Kumar

---

<div class="post-metadata">

**Author:** ![pulatoi](https://avatars.discourse-cdn.com/v4/letter/p/c89c15/32.png) [@pulatoi](https://developer.sailpoint.com/discuss/u/pulatoi)\
**Post date:** [October 29, 2024, 2:58pm UTC](https://developer.sailpoint.com/discuss/t/single-account-query-cannot-fetch-identity/87214/4 "2024-10-29T14:58:58Z")

</div>

“exception\_message”:“Conversion failed when converting the varchar value ‘$getObject.nativeIdentity’ to data type int.”},“stack”:“ccg”,“pod”:“stg02-useast1”,“connector-logging”:“163”,“Operation”:“GetObject”

This is weird, assuming that my native identity is string and not int, so why would it convert to int?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [December 28, 2024, 2:59pm UTC](https://developer.sailpoint.com/discuss/t/single-account-query-cannot-fetch-identity/87214/5 "2024-12-28T14:59:52Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
