Parcourir la source

Modify the function to return the whole tuple

DricomDragon il y a 5 ans
Parent
commit
ec8270b091
1 fichiers modifiés avec 3 ajouts et 3 suppressions
  1. 3 3
      SQL/plpgsql/create_biggest_ordered_quantity.sql

+ 3 - 3
SQL/plpgsql/create_biggest_ordered_quantity.sql

@@ -1,9 +1,9 @@
-CREATE OR REPLACE FUNCTION biggest_ordered_quantity() RETURNS INTEGER AS 
+CREATE OR REPLACE FUNCTION biggest_ordered_quantity() RETURNS OrderedItem AS 
 $$
 DECLARE
-    ans INTEGER;
+    ans OrderedItem;
 BEGIN
-    SELECT ori_quantity FROM OrderedItem ORDER BY ori_quantity DESC INTO ans;
+    SELECT * FROM OrderedItem ORDER BY ori_quantity DESC INTO ans;
 
     RETURN ans;
 END;