Estimados

Aca reprtandome nuevamente con este problema haber si me ayudan nuevamente....

Como avances les comento que ya logre hacer que la función corra pero no se 
porque razon la varible v_rec con el campo id_persona no tiene valor a pesar 
que el depurador me dice que si tiene 1 regsitro

LA FUNCIÓN danmaf.per_sp_obt_persona( '1711837219', null, null, 
null,'v_cur_resultado'); devuelve un refcursor

A continuaciòn anexo el código de la función:


CREATE OR REPLACE FUNCTION "danmaf"."fac_obt_cab_factura" (p_identificacion 
integer, p_fact_fisica varchar, p_fecha date, p_primer_nombre varchar, 
p_apellido_paterno varchar, p_razon_social varchar) RETURNS 
"pg_catalog"."refcursor" AS
$body$
DECLARE
 v_cur_resultado refcursor;
 v_rec record;
 v_mensaje varchar(10);
BEGIN

begin
open v_cur_resultado for 
SELECT danmaf.per_sp_obt_persona( '1711837219', null, null, 
null,'v_cur_resultado');

     loop
       fetch v_cur_resultado into v_rec;

          EXIT WHEN NOT FOUND;
         if v_rec.id_persona=4 then
         v_mensaje:='Ok';
         end if;
    end loop;


end;

END;
$body$
LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;



Cualquier ayuda se agradece,


> Date: Mon, 8 Dec 2008 14:22:29 -0300
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> CC: [EMAIL PROTECTED]; pgsql-es-ayuda@postgresql.org
> Subject: Re: [pgsql-es-ayuda] RE: Funciòn que devuelve un refcursor
> 
> ALFONSO REYES escribió:
> > 
> > 
> > Marcos, muchas gracias por tú ayuda, pero a lo que me refiero es como 
> > debería jecutarla desde el query builder, por ejemplo a las 
> > funciones que retirnan un refcursor se las ejecuta asi:
> > Begin;
> > select funcion('resp_ref_cursor');
> > fecth all in "resp_ref_cursor";
> > commit;
> > 
> > En cambio cuando es un afunción de tipo record como la ejecuto desde el 
> > query builder..
> 
> select * from function( ... )
> 
> Si es "setof record" entonces tienes que especificar el tipo del record:
> 
> select * from function( ... ) as f(a int, b text, c text, ...)
> 
> -- 
> Alvaro Herrera                               http://www.PlanetPostgreSQL.org/
> "I'm impressed how quickly you are fixing this obscure issue. I came from 
> MS SQL and it would be hard for me to put into words how much of a better job
> you all are doing on [PostgreSQL]."
>  Steve Midgley, http://archives.postgresql.org/pgsql-sql/2008-08/msg00000.php
> --
> TIP 3: Si encontraste la respuesta a tu problema, publícala, otros te lo 
> agradecerán

_________________________________________________________________
Invite your mail contacts to join your friends list with Windows Live Spaces. 
It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us

Responder a