summaryrefslogtreecommitdiff
path: root/sql/modules/Account.sql
blob: 36275744332e62dbee352c8f7e0920710ec8dce0 (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_is_orphaned (in_id int) RETURNS bool AS
  12. $$
  13. BEGIN
  14. SELECT 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;