summaryrefslogtreecommitdiff
path: root/sql/modules/Account.sql
blob: a47c640b5598f9ff5ffff659bd4dcfb1420ebe3e (plain)
  1. -- VERSION 1.3.0
  2. CREATE OR REPLACE FUNCTION account_get (in_id int) RETURNS chart AS
  3. $$
  4. DECLARE
  5. account chart%ROWTYPE;
  6. BEGIN
  7. SELECT * INTO account FROM chart WHERE id = in_id;
  8. RETURN account;
  9. END;
  10. $$ LANGUAGE plpgsql;
  11. CREATE OR REPLACE FUNCTION account_has_transactions (in_id int) RETURNS bool AS
  12. $$
  13. BEGIN
  14. PERFORM trans_id FROM acc_trans WHERE chart_id = in_id LIMIT 1;
  15. IF FOUND THEN
  16. RETURN true;
  17. ELSE
  18. RETURN false;
  19. END IF;
  20. END;
  21. $$ LANGUAGE plpgsql;