Parcourir la source

Add a sql function to sum whole quantity ordered

DricomDragon il y a 5 ans
Parent
commit
0f496976b5
1 fichiers modifiés avec 10 ajouts et 0 suppressions
  1. 10 0
      SQL/plpgsql/create_total_ordered.sql

+ 10 - 0
SQL/plpgsql/create_total_ordered.sql

@@ -0,0 +1,10 @@
+CREATE OR REPLACE FUNCTION total_ordered() RETURNS INTEGER language 'plpgsql' AS
+$BODY$
+DECLARE
+    ans INTEGER;
+BEGIN
+    SELECT SUM(ori_quantity) FROM OrderedItem INTO ans;
+    RETURN ans;
+END;
+$BODY$
+;