SELECT
CONCAT(dm.fn_trim(user_name),v_separator,dm.fn_trim(id_number),v_separator,dm.fn_trim(mobile),v_separator,dm.fn_trim(device),v_separator,dm.fn_trim(req_ip))
,CONCAT('userName:',dm.fn_trim(user_name),',ID:',dm.fn_trim(id_number),',tel:',dm.fn_trim(mobile),',device:',dm.fn_trim(device),',ip:',dm.fn_trim(req_ip),',phone:',dm.fn_trim(company_phone),',company:',dm.fn_trim(company_name),',bank_no:',dm.fn_trim(bank_no)) INTO v_userInfo,v_userInfo2
from dw.dw_fraud_user_auth_info as a
where left(auth_time,19) in(
SELECT max(left(auth_time,19)) as auth_time from dw.dw_fraud_user_auth_info where uuid=v_user_id and system_name=p_systemName
) and uuid=v_user_id and system_name=p_systemName;