=SELECT CASE
WHEN decode(instr(frv.responsibility_name, '_', -1),
0,
NULL,
substr(frv.responsibility_name,
instr(frv.responsibility_name, '_', -1) + 1)) IS NOT NULL AND
cux_gl_num_utl.get_batch_num(p_resp_id => frv.responsibility_id,
p_user_id => fnd_profile.value('USER_ID')) IS NOT NULL THEN
(SELECT description
FROM fnd_user
WHERE user_id = fnd_profile.value('USER_ID')) || '-' ||
to_char(SYSDATE, 'YYYYMMDD') || '-' ||
cux_gl_num_utl.get_batch_num(p_resp_id => frv.responsibility_id,
p_user_id => fnd_profile.value('USER_ID'))
ELSE
NULL
END
FROM fnd_responsibility_vl frv
WHERE frv.responsibility_id = fnd_profile.value('RESP_ID')