浏览代码

Modify the function to return the whole tuple

DricomDragon 5 年之前
父节点
当前提交
ec8270b091
共有 1 个文件被更改,包括 3 次插入3 次删除
  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;