CREATE OR REPLACE FUNCTION transactions.get_default_currency_code(cash_repository_id integer)
RETURNS character varying
LANGUAGE plpgsql
AS $function$
BEGIN
RETURN
(
SELECT office.offices.currency_code
FROM office.cash_repositories
INNER JOIN office.offices
ON office.offices.office_id = office.cash_repositories.office_id
WHERE office.cash_repositories.cash_repository_id=$1
);
END
$function$