| From: | "Roberto Aguirre" <raguirre(at)infonegocio(dot)net(dot)pe> |
|---|---|
| To: | |
| Cc: | "'pgsql-es-ayuda:postgresql(dot)org'" <pgsql-es-ayuda(at)postgresql(dot)org> |
| Subject: | RE: Problemas con SUBSTRING |
| Date: | 2005-10-21 22:23:37 |
| Message-ID: | 000601c5d68e$16060300$0401a8c0@srvcampos |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-es-ayuda |
Hola a todos tengo el sgte problema:
Tengo el siguiente function procedure
CREATE OR REPLACE FUNCTION sgct.fp_pais()
RETURNS SETOF record AS
$BODY$
DECLARE
registro record;
BEGIN
for registro in select SUBSTRING(codubi,1,3) AS CODIGO from sgct.ubigeo
loop
RETURN next registro;
end loop;
Return;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
Al invocarlo para que me retorne los registros
select * from sgct.fp_pais() As (CODIGO CHAR);
Me sale el sgte error:
ERROR: wrong record type supplied in RETURN NEXT
CONTEXT: PL/pgSQL function "fp_pais" line 6 at return next
Pero si quito el SUBSTRING me arroja registros sin problemas.
A que se puede deber esto?
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Dimas Ayala | 2005-10-21 22:26:15 | Re: Mensaje personalizado de error en regla. |
| Previous Message | Mario Gonzalez | 2005-10-21 21:59:53 | Re: Hola. Pasar datos en archivos de texto a tablas |