Browse Source

Modify the function to return the whole tuple

DricomDragon 5 years ago
parent
commit
ec8270b091
1 changed files with 3 additions and 3 deletions
  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;