From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
---|---|
To: | Linder Poclaba <linder(dot)poclaba(at)gmail(dot)com> |
Cc: | Eliana Gutierrez <egp1962(at)yahoo(dot)com(dot)au>, pgsql-es-ayuda(at)postgresql(dot)org |
Subject: | Re: Procedure en postgres |
Date: | 2006-11-06 01:58:40 |
Message-ID: | 20061106015840.GA3607@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
Linder Poclaba escribió:
> 2006/11/5, Eliana Gutierrez <egp1962(at)yahoo(dot)com(dot)au>:
> CREATE OR REPLACE FUNCTION nombre_funcion() RETURNS SETOF RECORD AS '
> DECLARE registro RECORD;
> BEGIN
> FOR registro IN _aqui_tu_consulta LOOP
> RETURN NEXT registro;
> END LOOP;
> RETURN;
> END;
> 'LANGUAGE 'plpgsql';
Realmente esto se puede hacer mucho mas simple:
create or replace function nombre_function() returns setof record as '
select los, campos, de, la, consulta
from la_tabla join la_otra_tabla on (blah blah)
where ...
' language sql;
No hay necesidad de invocar PL/pgSQL para algo tan simple.
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
From | Date | Subject | |
---|---|---|---|
Next Message | Eliana Gutierrez | 2006-11-06 02:05:49 | Re: Procedure en postgres |
Previous Message | Linder Poclaba | 2006-11-06 01:44:31 | Re: Procedure en postgres |