corrected name of file to be in line with the proc name

This commit is contained in:
Peter Wood
2023-03-04 21:08:28 -05:00
parent d5ca077424
commit e88dffe457
2 changed files with 34 additions and 13 deletions

View File

@@ -1,13 +0,0 @@
CREATE OR REPLACE PROCEDURE public.update_budget_from_import()
LANGUAGE plpgsql
AS $procedure$
begin
truncate public.budgetdetails;
insert into public.budgetdetails (trxdescription, trxdate, trxamount)
select description, cast(dt as date) as dt_converted, amount
from public.budgetimport;
end
$procedure$;
GRANT EXECUTE ON PROCEDURE public.update_budget_from_import() TO acedanger;

View File

@@ -0,0 +1,34 @@
CREATE OR REPLACE PROCEDURE public.update_budget_from_import()
LANGUAGE plpgsql
AS $$
declare
_acct int;
begin
select acct.acct_id
into _acct
from public.accounts acct
where
lower(acct.bank_name) = 'bank of america'
and acct.account_number = '4581';
if _acct is null
then
raise notice 'could not get the account id';
end if;
truncate public.budgetdetails;
insert into public.budgetdetails (trx_description, trx_date, trx_amount, acct_id)
select
description
, cast(dt as date) as dt_converted
, amount
, _acct
from public.budgetimport;
end
$$;
GRANT EXECUTE ON PROCEDURE public.update_budget_from_import() TO acedanger;
GRANT EXECUTE ON PROCEDURE public.update_budget_from_import() TO budgetuser;