Delimiter !
Drop Procedure If exists TESTS_TMP_LATE_INTEREST_POPULE_TABLES !
Create Procedure TESTS_TMP_LATE_INTEREST_POPULE_TABLES()
Begin
	-- la grille de taux
	Truncate table TMP_LATE_INTEREST_RATES;

	INSERT INTO TMP_LATE_INTEREST_RATES (
		TMP_LATE_INTEREST_RATES__LATE_INTEREST_NAMEID, TMP_LATE_INTEREST_RATES__DATE, TMP_LATE_INTEREST_RATES__RATE
	) 
	VALUES 
		(5, '1980-01-01', 0.18000)
		, (5, '2013-06-25', 0.15000)
		, (5, '2013-10-01', 0.17000)
		, (5, '2015-01-01', 0.18000)
		, (5, '2015-03-25', 0.18000)
		, (15, '1980-01-01', 0.10000)
		, (15, '2013-06-25', 0.14000)
		, (15, '2013-10-01', 0.20000)
		, (15, '2015-01-01', 0.18000)
		, (15, '2015-03-25', 0.18000)
	;

	-- les donné de regrouppement
	-- les ecriture les plus ancienne par rapport à la donné de consolidation
	Truncate table TMP_LATE_INTEREST_TRG_DATA ;
	INSERT INTO TMP_LATE_INTEREST_TRG_DATA (
			TMP_LATE_INTEREST_TRG_DATA__DATAID, TMP_LATE_INTEREST_TRG_DATA__GRPID
			, TMP_LATE_INTEREST_TRG_DATA__LATE_INTEREST_NAMEID
			, TMP_LATE_INTEREST_TRG_DATA__PENALITY_AMOUNT
	) 
	VALUES 
		(24045, 38506, 5, 0)
	;


	-- les ecritures
	Truncate Table TMP_LATE_INTEREST_SRC_DATA;
	INSERT INTO TMP_LATE_INTEREST_SRC_DATA (
		TMP_LATE_INTEREST_SRC_DATA__DATAID, TMP_LATE_INTEREST_SRC_DATA__TMP_LATE_INTEREST_TRG_DATAID
		, TMP_LATE_INTEREST_SRC_DATA__DATE, TMP_LATE_INTEREST_SRC_DATA__AMOUNT
		, TMP_LATE_INTEREST_SRC_DATA__ALLOW_NEGATIVE_PENALITY
	) 
	VALUES 
		(24045, 24045, '2013-04-30', 94.98000, 0)
		, (24046, 24045, '2013-07-18', 58.00000, 0)
		, (24047, 24045, '2013-07-31', 58.00000, 0)
		, (24048, 24045, '2014-04-30', 320.22000, 0)
		, (24049, 24045, '2014-08-31', 255.38000, 0)
	;

End !
Delimiter ;