From: | "Edwin Quijada" <listas_quijada(at)hotmail(dot)com> |
---|---|
To: | pgsql-es-ayuda(at)postgresql(dot)org |
Subject: | Re: get diagnostics row_count y cursores |
Date: | 2005-10-27 21:09:15 |
Message-ID: | BAY113-F116226EF639929A87F10F2E3680@phx.gbl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
Puedes hacer
select count(*) into vlvalor from tabla;
*-------------------------------------------------------*
*-Edwin Quijada
*-Developer DataBase
*-JQ Microsistemas
*-809-747-2787
* " Si deseas lograr cosas excepcionales debes de hacer cosas fuera de lo
comun"
*-------------------------------------------------------*
>From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
>To: Juan Pablo Yañez <jyanez(at)sigma(dot)gov(dot)bo>
>CC: pgsql-es-ayuda <pgsql-es-ayuda(at)postgresql(dot)org>
>Subject: Re: [pgsql-es-ayuda] get diagnostics row_count y cursores
>Date: Thu, 27 Oct 2005 10:15:42 -0300
>
>Juan Pablo Yañez escribió:
> > Hola señores, tengo la siguiente funcion:
> >
> > CREATE OR REPLACE FUNCTION test() RETURNS integer AS
> > $body$
> > declare
> > vl integer;
> > vlvalor varchar;
> > begin
> > select columnaX into vlvalor from tablaX;
> > if not found then
> > raise notice 'no hay datos';
> > else
> > get diagnostics vl := row_count;
> > raise notice 'deberia mostrar el numero de filas devueltas: %',vl;
> > end if;
> > return vl;
> > end;
> > $body$
> > LANGUAGE 'plpgsql';
> >
> > Lo que espero que me devuelva la funcion es el numero de filas
> > recuperado por el select pero siempre devuelve 1. Que es lo que estoy
> > haciendo mal ?
>
>El SELECT INTO puede recibir solamente una tupla. Prueba cambiando esa
>linea por
>
> perform columnaX from tablaX;
>
>--
>Alvaro Herrera
>http://www.PlanetPostgreSQL.org
>"If you have nothing to say, maybe you need just the right tool to help you
>not say it." (New York Times, about Microsoft PowerPoint)
>
>---------------------------(fin del mensaje)---------------------------
>TIP 10: visita nuestro canal de IRC #postgresql-es en irc.freenode.net
_________________________________________________________________
¿Cuánto vale tu auto? Tips para mantener tu carro. ¡De todo en MSN Latino
Autos! http://latino.msn.com/autos/
From | Date | Subject | |
---|---|---|---|
Next Message | Edwin Quijada | 2005-10-27 21:18:46 | RE: Debug en trigger |
Previous Message | Alvaro Herrera | 2005-10-27 21:07:59 | Re: Extract con timestamp |