我必须完成此代码段
begin transaction;
create or replace function amort(amount decimal, periodiquepayment decimal, interet decimal)
returns table (periodereq decimal, payreq decimal, restreq decimal) as
$$
begin
[...]
end
$$
language 'plpgsql';
select * from amort(50000.00,500.00, 0.10);
rollback;
以及[...]的位置,我应该实施递归WITH以计算定期付款的值。但是我没有尝试过。我什至无法获得正确的语法来正确地使用:(第一个参数是总金额,第二个参数是定期付款,第三个参数是每次定期付款后应用于总金额的利息
CREATE FUNCTION amort(amount decimal, periodiquepayment decimal, interet decimal)
RETURNS TABLE (periodereq decimal, payreq decimal, restreq decimal)
LANGUAGE sql AS
$$WITH ... AS (...)
SELECT ...$$;