|< < 40 > >|

Postgres Stored Procedures

Yet another function to convert dollars to euros

Take an account row as input and return the balance as euros.
create function euros(acct account) returns numeric(10, 2) as $$ declare to_euros_rate numeric(16, 6); begin select to_rate into to_euros_rate from conversion where currency = 'euro'; return (acct.balance * to_euros_rate)::numeric(10, 2); end $$ language plpgsql;

|< < 40 > >|