For first option I have below query which returns all identities with source=âMailTFAYD:mailâ:
SELECT NAME, EMAIL_SOURCE FROM (
SELECT
NAME NAME, xmltype(ATTRIBUTE_META_DATA).extract('/List/AttributeMetaData[@attribute="email"]/@source').getStringVal() AS EMAIL_SOURCE
FROM spt_identity
WHERE
XMLEXISTS('/List/AttributeMetaData[@attribute="email" and @source="MailTFAYD:mail"]' PASSING XMLType(ATTRIBUTE_META_DATA))
AND ATTRIBUTE_META_DATA IS NOT NULL
AND length(ATTRIBUTE_META_DATA) > 1
)
WHERE EMAIL_SOURCE IS NOT NULL
AND length(EMAIL_SOURCE) > 1;
Now I need query to find all the identites where attribute meta data is of type 4, and need NAME, âuserâ and âLastValueâ.
SELECT NAME, EMAIL_SOURCE
FROM (
SELECT
NAME AS NAME,
xmltype(ATTRIBUTE_META_DATA).extract(â/AttributeMetaData[@attribute=âemailâ]/LastValue/Stringâ).getStringVal() AS EMAIL_SOURCE
FROM spt_identity
WHERE
XMLEXISTS(â/AttributeMetaData[@attribute=âemailâ]â PASSING XMLType(ATTRIBUTE_META_DATA))
AND ATTRIBUTE_META_DATA IS NOT NULL
AND length(ATTRIBUTE_META_DATA) > 1
)
WHERE EMAIL_SOURCE IS NOT NULL
AND length(EMAIL_SOURCE) > 1;
Thank you for your reply. While running to your query I did not get any record.
When I tried below query I get 200+ records:
SELECT NAME FROM spt_identity
WHERE
xmltype(ATTRIBUTE_META_DATA).extract('/List/AttributeMetaData[@attribute="email"]/@modified').getStringVal() IS NOT NULL
AND ATTRIBUTE_META_DATA IS NOT NULL
AND length(ATTRIBUTE_META_DATA) > 1;
Could you please help me update this query so that I can get other two informaton which is there in option 4 like âuserâ and LastValue/String as HR_Email?
SELECT NAME, USER_ID, LAST_VALUE FROM (
SELECT
NAME NAME,
xmltype(ATTRIBUTE_META_DATA).extract('/List/AttributeMetaData[@attribute="email"]/@user').getStringVal() AS USER_ID,
xmltype(ATTRIBUTE_META_DATA).extract('/List/AttributeMetaData[@attribute="email"]/LastValue/String/text()').getStringVal() AS LAST_VALUE
FROM spt_identity
WHERE
XMLEXISTS('/List/AttributeMetaData[@attribute="email" and @user and /LastValue/String]' PASSING XMLType(ATTRIBUTE_META_DATA))
AND ATTRIBUTE_META_DATA IS NOT NULL
AND length(ATTRIBUTE_META_DATA) > 1
)
WHERE USER_ID IS NOT NULL
AND length(USER_ID) > 1
AND LAST_VALUE IS NOT NULL
AND length(LAST_VALUE) > 1;