Database Reference
In-Depth Information
CREATE OR REPLACE FUNCTION unnest_v(VARIADIC
arr anyarray)
RETURNS SETOF anyelement AS $$
BEGIN
RETURN QUERY SELECT unnest(arr);
END;
$$ LANGUAGE plpgsql;
The previous code snippet is another simple example with little real world value, but
it shows how to construct a function with variable arguments.
hannu=# select unnest_v(1,2,3,4);
-[ RECORD 1 ]
unnest_v | 1
-[ RECORD 2 ]
unnest_v | 2
-[ RECORD 3 ]
unnest_v | 3
-[ RECORD 4 ]
unnest_v | 4
Search WWH ::




Custom Search