forked from brmlab/brmbar-github
Schema 0017: fix into syntax
This commit is contained in:
parent
3b0cb6472d
commit
f7f137821b
1 changed files with 4 additions and 2 deletions
|
@ -40,8 +40,10 @@ DECLARE
|
||||||
v_crsum NUMERIC;
|
v_crsum NUMERIC;
|
||||||
v_dbsum NUMERIC;
|
v_dbsum NUMERIC;
|
||||||
BEGIN
|
BEGIN
|
||||||
SELECT COALESCE(SUM(CASE WHEN side='credit' THEN amount ELSE 0 END),0) crsum INTO v_crsum,
|
SELECT
|
||||||
COALESCE(SUM(CASE WHEN side='debit' THEN amount ELSE 0 END),0) dbsum into v_dbsum
|
COALESCE(SUM(CASE WHEN side='credit' THEN amount ELSE 0 END),0) crsum,
|
||||||
|
COALESCE(SUM(CASE WHEN side='debit' THEN amount ELSE 0 END),0) dbsum
|
||||||
|
INTO v_crsum, v_dbsum
|
||||||
FROM public.transaction_splits ts WHERE ts.account=4
|
FROM public.transaction_splits ts WHERE ts.account=4
|
||||||
RETURN v_dbsum - v_crsum;
|
RETURN v_dbsum - v_crsum;
|
||||||
END; $$;
|
END; $$;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue