Skip to content

Instantly share code, notes, and snippets.

@vmussak
Last active March 15, 2017 03:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vmussak/380fe5c79b4a7ac43fafa6a8242802bf to your computer and use it in GitHub Desktop.
Save vmussak/380fe5c79b4a7ac43fafa6a8242802bf to your computer and use it in GitHub Desktop.
Exemplo de procedure do postgreSQL
CREATE OR REPLACE FUNCTION autenticacao.BuscarUsuario(pNome varchar(50), pNomeDaMae varchar(50))
RETURNS TABLE(
"id" integer,
"nome" varchar(50),
"nomeDaMae" varchar(50)
) AS $$
BEGIN
RETURN QUERY
SELECT u.id,
u.nome,
u.nomeDaMae
FROM autenticacao.usuario u
WHERE u.nome ILIKE pNome
AND u.nomeDaMae ILIKE pNomeDaMae;
END;
$$
LANGUAGE plpgsql;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment