Saulo Morais Lara escreveu:
> Estou vendo um jeito de facilitar e tornar rápidas minhas consultas 
> através de views.
> 
> (...)
> 
> CREATE OR REPLACE FUNCTION consulta(campos text, tabela text, chave 
> text, id integer)
> 
>   RETURNS void AS
> $BODY$
> BEGIN
>                 EXECUTE 'CREATE VIEW consulta AS SELECT ' || campos || ' 
> FROM ' || tabela || ' WHERE ' || chave || ' = ' || id;
> END;     
> $BODY$
>   LANGUAGE 'plpgsql' VOLATILE
>  (...)
> 
> Gostaria de saber se existe um jeito de chamar uma view com parâmetros, 
> ou algo parecido. Ou alguma dica.

Que tal usar um RETURNS SETOF na própria FUNCTION?

-- 
[]s
Dickson S. Guedes
-------------------------------------
Projeto Colmeia - Curitiba - PR
(41) 3254-7130 ramal: 27
http://makeall.wordpress.com/
http://planeta.postgresql.org.br/
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a