Delimiter //
/**
 * Author:  armen
 * Created: 13 nov. 2019
 */

drop function if exists CASH_LOADER_ACCOUNTS_has_MEMBERS_GET_REF //

Create Function CASH_LOADER_ACCOUNTS_has_MEMBERS_GET_REF(
		batch_num Int unsigned
	)
	returns varchar(40)
Begin
	return  Concat(
                'AUTO.'
                , MD5(
                    Concat(
                            Coalesce(GET_LOADER_INFO('SRC_FILE_NAME', batch_num)
                                    , ''
                                )
                            , '.'
                            , Coalesce(GET_LOADER_INFO('TREATEMENT_DATE', batch_num)
                                    , ''
                                )
                        )
                )
            )
        ;
End //
Delimiter ;
