Ver código fonte

Modify the function to return the whole tuple

DricomDragon 5 anos atrás
pai
commit
ec8270b091
1 arquivos alterados com 3 adições e 3 exclusões
  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;