Delimiter //
Drop Procedure If Exists LOADER_RECLAIMS_NORMALIZE_CHECK_ENTRIES_ACC_EXT_REF_NOTNULL//
Create Procedure LOADER_RECLAIMS_NORMALIZE_CHECK_ENTRIES_ACC_EXT_REF_NOTNULL(
    In batchnum Int
)
Begin

	call LOADER_BUILD_RECLAIMS_CHECK_BASE_QUERY (
				'ENTRIES_ACC_EXT_REF', batchnum, 'Entries ref could not be empty', '', 0, @query
			)
		;
	set @query = Concat(@query
					, ' And Coalesce(ENTRIES_ACC_EXT_REF, '''') = '''' '
				)
			;

	PREPARE stmt FROM @query;
	execute stmt			
		;
	Deallocate prepare stmt;

End//
Delimiter ;