-
+
User-Defined Functions
+ It is also possible to return multiple rows with the columns defined by
+ output parameters, like this:
+
+CREATE FUNCTION sum_n_product_with_tab (x int, OUT sum int, OUT product int) RETURNS SETOF record AS $$
+ SELECT x + tab.y, x * tab.y FROM tab;
+$$ LANGUAGE SQL;
+
+
+ The key point here is that you must write RETURNS SETOF record>
+ to indicate that the function returns multiple rows instead of just one.
+ If there is only one output parameter, write that parameter's type
+ instead of record>.
+
+
Currently, functions returning sets can also be called in the select list
of a query. For each row that the query