PES_MACRO_CURRENT_RESOURCE

PES_MACRO_CURRENT_RESOURCE returns the id of the current session resource if there is one, null if no resource for current user:
SELECT obj_UID FROM PES_Resource WHERE obj_UID = PES_FUNCTION_CURRENT_RESOURCE()