Delimiter //
/**
 * 
 * @author armen
 * @ticket #5601
 */ 
Drop Procedure If Exists LOADER_ENTRIES_NORMALIZE_MAP_STATUS_NOTPROVIDED //
Create Procedure LOADER_ENTRIES_NORMALIZE_MAP_STATUS_NOTPROVIDED(
    In batch_num Int
)
Begin
    main: Begin
		
        Call LOADER_BUILD_ENTRIES_CHECK_BASE_QUERY('ENTRIES_STATUS_CODE'
                                                    , batch_num 
														-- ne pas metre de cotes dans les libelle
                                                    , 'Statut d écriture non valide'
                                                    , null, 1
                                                    , @query
                                                )
                                            ;

        Set @query = Concat(@query
                            , ' And LOADER_ENTRIES.DF_ENTR_STT_ID_DF_ENTR_STT Is Null' 
                            , ' And Coalesce(LOADER_ENTRIES.ENTRIES_STATUS_CODE, '''') <> '''' '
                        )
                    ;
        PREPARE stmt FROM @query;
		Execute stmt;
		Deallocate prepare stmt;

    End ;

End //
Delimiter ;