summaryrefslogtreecommitdiff
path: root/sql/modules/Date.sql
blob: 7b942c2a8b25c4e4f2af525fe744bd80f2b3b145 (plain)
  1. CREATE OR REPLACE FUNCTION date_get_all_years() returns setof INT AS
  2. $$
  3. DECLARE
  4. date_out record;
  5. BEGIN
  6. FOR date_out IN
  7. SELECT EXTRACT('YEAR' from transdate) AS year
  8. FROM acc_trans
  9. GROUP BY EXTRACT('YEAR' from transdate)
  10. ORDER BY year
  11. LOOP
  12. return next date_out.year;
  13. END LOOP;
  14. END;
  15. $$ language plpgsql;
  16. COMMENT ON FUNCTION date_get_all_years() IS
  17. $$ This function return each year inside transdate in transactions. $$;