From: | jeferson alvarez <jalvarez(at)renova(dot)com(dot)pe> |
---|---|
To: | Espartano <espartano(dot)mail(at)gmail(dot)com>, pgsql-es-ayuda(at)postgresql(dot)org |
Subject: | Re: AYUDITA CON UNA FUNCION |
Date: | 2007-02-08 19:44:41 |
Message-ID: | 45CB7DA9.7090207@renova.com.pe |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
si tenias razon al final quedo asi gracias:
CREATE OR REPLACE FUNCTION alm_t_detalle_Crear(
ialdt_ch_id char(50),
ialdt_in_idCab int4,
ialdt_in_orden int4,
ialdt_ch_doc_corre char(15),
ialdt_do_subtotal float8,
ialdt_do_valor_unitario float8,
ialdt_do_cantidad float8,
iarti_in_id int4 )
RETURNS int4 AS
$BODY$
DECLARE
xaldt_in_idDet int4;
xaldt_in_orden int4;
BEGIN
select into xaldt_in_idDet max(aldt_in_idDet) from alm_t_detalle;
select into xaldt_in_orden max(aldt_in_idDet) from alm_t_detalle
where aldt_ch_id=$1;
--xaldt_in_idDet=alm_t_detalle_MaxID();
IF xaldt_in_idDet=Null THEN
xaldt_in_idDet=1;
ELSE
xaldt_in_idDet=xaldt_in_idDet+1;
END IF;
insert into alm_t_detalle (aldt_ch_id,
aldt_in_idCab,aldt_in_idDet, aldt_in_orden, aldt_ch_doc_corre,
aldt_do_subtotal,aldt_do_valor_unitario, aldt_do_cantidad, arti_in_id)
values
($1,$2,xaldt_in_idDet,xaldt_in_orden,$4,$5,$6,$7,$8);
RETURN 0;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
From | Date | Subject | |
---|---|---|---|
Next Message | jeferson alvarez | 2007-02-08 19:44:54 | Error en funcion |
Previous Message | Alvaro Herrera | 2007-02-08 19:33:48 | Re: Obtener los primeros registros de una consulta. |