Skip site navigation (1) Skip section navigation (2)

RE: Return Query

From: Edwin Quijada <listas_quijada(at)hotmail(dot)com>
To: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>
Cc: <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: RE: Return Query
Date: 2008-06-30 15:12:28
Message-ID: BLU137-W33F061EC2F2C885AC39DFCE39F0@phx.gbl (view raw or flat)
Thread:
Lists: pgsql-es-ayuda

> fijate que debe haber tantos parametros OUT como columnas en el select

create or replace function f1(out id_record integer, out alias text)
returns setof record as
 $$
 begin
  return query select id_record,alias from uno_email_alias;
 end;
 $$ language plpgsql;
 


select * from f1()


tengo 2 out y dos columnas y sigue el mismo error



*-------------------------------------------------------*
*-Edwin Quijada
*-Developer DataBase
*-JQ Microsistemas
*-809-849-8087

* " Si deseas lograr cosas excepcionales debes de hacer cosas fuera de lo comun"
*-------------------------------------------------------*


> Date: Sun, 29 Jun 2008 22:24:56 -0500
> From: jcasanov(at)systemguards(dot)com(dot)ec
> To: listas_quijada(at)hotmail(dot)com
> Subject: Re: [pgsql-es-ayuda] Return Query
> CC: pgsql-es-ayuda(at)postgresql(dot)org
>
> On Sun, Jun 29, 2008 at 6:19 PM, Edwin Quijada
>  wrote:
>>
>> Consigo este error cuando lo hago asi
>>
>> ERROR: structure of query does not match function result type
>> CONTEXT: PL/pgSQL function "f1" line 2 at RETURN QUERY
>>
>
> fijate que debe haber tantos parametros OUT como columnas en el select
>
> --
> Atentamente,
> Jaime Casanova
> Soporte y capacitación de PostgreSQL
> Guayaquil - Ecuador
> Cel. (593) 87171157
> --
> TIP 10: no uses HTML en tu pregunta, seguro que quien responda no podrá leerlo

_________________________________________________________________
Blog your life in 3D with Windows Live Writer.
http://www.windowslive.com/overview.html?ocid=TXT_TAGLM_Wave2_wl_writer_022008

In response to

Responses

pgsql-es-ayuda by date

Next:From: Alvaro HerreraDate: 2008-06-30 15:26:11
Subject: Re: Return Query
Previous:From: Alvaro HerreraDate: 2008-06-30 13:53:57
Subject: Re: uso transacciones en plpgsql

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group