Re: error al crear funcion "no existe tabla temporal"

From: jeferson alvarez <jalvarez(at)renova(dot)com(dot)pe>
To: Jaime Casanova <systemguards(at)gmail(dot)com>, pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: error al crear funcion "no existe tabla temporal"
Date: 2007-03-17 15:37:13
Message-ID: 45FC0B29.6050501@renova.com.pe
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

le faltaba el temp pero igual

CREATE OR REPLACE FUNCTION alma_p_inventario_obtener(
ialma_in_id int4,
ifecha char(10))
RETURNS setof type_alma_p_inventario_obtener AS
$BODY$
* execute 'select arti_in_id,max(kard_in_id) as id_kardex
into temp axxxx
from alma_p_kardex
where
fecha_a_numero(kard_ch_fecha)<=fecha_a_numero($2) and
alma_in_id=$1
group by alma_in_id,arti_in_id';*

execute 'select
a.*,kard_ch_fecha,kard_do_saldo,kard_do_precio_prom,kadr_do_saldo_moneda,
(select sum(kard_do_cant_ing)
from alma_p_kardex
where alma_in_id=1 and
fecha_a_numero(kard_ch_fecha)<=fecha_a_numero($2) and
kard_ch_tipo_mov=''ING'' and
arti_in_id=a.arti_in_id) as Ingresos,
(select sum(kard_do_cant_ing)
from alma_p_kardex
where alma_in_id=1 and
fecha_a_numero(kard_ch_fecha)<=fecha_a_numero($2) and
kard_ch_tipo_mov=''SAL'' and
arti_in_id=a.arti_in_id) as salidas
into temp inventario
from axxxx a
left join alma_p_kardex k on a.id_kardex=k.kard_in_id';

select
i.arti_in_id,a.arti_vc_descripcion,c.conc_vc_desc,coalesce(i.ingresos,0.00000)-coalesce(i.salidas,0.00000)
as saldo,i.kard_ch_fecha,
i.kard_do_precio_prom,i.kadr_do_saldo_moneda
from inventario i
left join sgc_m_articulo a on i.arti_in_id=a.arti_in_id
left join sgc_m_conceptos c on
c.conc_ch_codigo=a.arti_ch_und and c.conc_ch_tipo='UMD';

$BODY$
LANGUAGE 'sql' VOLATILE;

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Damian Culotta 2007-03-17 15:48:34 Re: Mostrar caracteres acentuados en PHP
Previous Message Jaime Casanova 2007-03-17 15:16:45 Re: error al crear funcion "no existe tabla temporal"