I'm having some trouble executing some macros in TERADATA. I have one big macro that includes 3 other macros. It looks like this:
create MACRO D_RISK_SANDBOX.saldo_pagos(fecha_desde date, fecha_hasta date, fecha_fin_desde date, fecha_fin_hasta date)
as
(
 exec D_RISK_SANDBOX.saldo ( :fecha_desde,:fecha_hasta);
 exec D_RISK_SANDBOX.pagos_cuotas( :fecha_desde,:fecha_hasta,:fecha_fin_desde,:fecha_fin_hasta);
 exec D_RISK_SANDBOX.pagos_refin( :fecha_desde,:fecha_hasta,:fecha_fin_desde,:fecha_fin_hasta);
)
exec D_RISK_SANDBOX.saldo_pagos('2016/08/01','2016/08/31','2016/09/01','2019/08/31')
Today I execute the big macro (D_RISK_SANDBOX.saldo_pagos) for each month I need. It would be easier to make a loop, but I don't know how. I've been reading about store procedures, but I don't know how to make a loop with dates. The dates could be in an array so I can have something like this: (The first column Is the date, the others columns are the result of each "little" macro)


