Skip to content

Instantly share code, notes, and snippets.

@sebawebber
Created August 23, 2016 17:29
Show Gist options
  • Select an option

  • Save sebawebber/c12d2bde840900623336019f0e427e3c to your computer and use it in GitHub Desktop.

Select an option

Save sebawebber/c12d2bde840900623336019f0e427e3c to your computer and use it in GitHub Desktop.
exemplo de retorno de multiplas linhas em PL/PGSQL
CREATE OR REPLACE FUNCTION fnc_intervalo()
RETURNS SETOF interval AS
$$
DECLARE
BEGIN
RETURN NEXT 1;
RETURN NEXT 2;
END;
$$ LANGUAGE 'plpgsql';
sebastian=# select fnc_test();
fnc_test
----------
1
2
(2 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment