Delimiter //
/**
 * Errors: accounts whose have an error one the balance control
 * 
 * @author Jean-François
 */
Drop Procedure if exists LOADER_CREATE_TABLE_BALANCECONTROL_ACCOUNTS_STATUS//

Create Procedure LOADER_CREATE_TABLE_BALANCECONTROL_ACCOUNTS_STATUS ()
Begin

    Drop Table If Exists LOADER_BALANCECONTROL_ACCOUNTS_STATUS;

    Create Table LOADER_BALANCECONTROL_ACCOUNTS_STATUS(

        -- champ auto increment, initialisé avant chanque import
        ID_LOADER_BALANCECONTROL_ACCOUNTS_STATUS Int Unsigned Not Null Auto_increment,

        LOADER_BALANCECONTROL_ACCOUNTS_STATUS_ERRCOUNT Int Not Null default 0, 
        LOADER_BALANCECONTROL_ACCOUNTS_STATUS_ERRMSGS TEXT Null, 
        ACCOUNTS_ID_ACCOUNTS Int Unsigned Null,

        -- contraintes et indexes
        Primary Key (ID_LOADER_BALANCECONTROL_ACCOUNTS_STATUS)
		, Index (ACCOUNTS_ID_ACCOUNTS)

    ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

End //

Delimiter ;
CALL LOADER_CREATE_TABLE_BALANCECONTROL_ACCOUNTS_STATUS();