Re: Regresa el Numero de filas afectadas en un funcion

From: Miguel Angel Hernandez Moreno <miguel(dot)hdz(dot)mrn(at)gmail(dot)com>
To: manuel antonio ochoa <manuel8aalfaro(at)gmail(dot)com>
Cc: pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: Regresa el Numero de filas afectadas en un funcion
Date: 2011-08-25 18:17:30
Message-ID: CAGYOd3qZYBx8jreCFBzJEUWk3wfXBXnC=iwc5VLJ7giZEqRgGQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Saludos manuel

hace rato que ya no hablas, lo que buscas creo que se puede hacer asi

CREATE OR REPLACE FUNCTION nipcaredb.agvalserial(
character varying, character varying, character varying)
RETURNS *integer* AS
$BODY$
DECLARE
serial ALIAS FOR $1;
hd ALIAS FOR $2;
OS ALIAS FOR $3;
* no_rows int;*
resultado_BOL BOOLEAN DEFAULT '0';
BEGIN

RAISE NOTICE ' serial %',serial;
RAISE NOTICE ' hd %',hd;
RAISE NOTICE ' OS %',OS;

INSERT INTO nipcaredb.dispositivos(idctrl, dispositivo, so )
(SELECT b.idctrl AS idctrl, hd,OS
FROM nipcaredb.seriales as a ,nipcaredb.ctrlproductos as
b,nipcaredb.clientes as c
where a.serial=serial and a.idserial=b.idserial and c.idcliente=b.idcliente
);
*get diagnostics no_rows = ROW_COUNT;*

*return no_rows;
*
2011/8/25 manuel antonio ochoa <manuel8aalfaro(at)gmail(dot)com>

> que tal buenas tardes lista de ayuda,
> como puedo regresas el numero de filas afectadas
>
> CREATE OR REPLACE FUNCTION nipcaredb.agvalserial(character varying,
> character varying, character varying)
> RETURNS boolean AS
> $BODY$
> DECLARE
> serial ALIAS FOR $1;
> hd ALIAS FOR $2;
> OS ALIAS FOR $3;
>
> resultado_BOL BOOLEAN DEFAULT '0';
> BEGIN
>
> RAISE NOTICE ' serial %',serial;
> RAISE NOTICE ' hd %',hd;
> RAISE NOTICE ' OS %',OS;
>
>
>
> INSERT INTO nipcaredb.dispositivos(idctrl, dispositivo, so )
> (SELECT b.idctrl AS idctrl, hd,OS
> FROM nipcaredb.seriales as a ,nipcaredb.ctrlproductos as
> b,nipcaredb.clientes as c
> where a.serial=serial and a.idserial=b.idserial and
> c.idcliente=b.idcliente
> );
>
get diagnostics no_rows = ROW_COUNT;

--
ISC Miguel Angel Hernandez Moreno

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Mario Sileone 2011-08-25 18:37:26 Re: consulta sobre postgis para encontrar un punto concreto
Previous Message manuel antonio ochoa 2011-08-25 18:10:46 Regresa el Numero de filas afectadas en un funcion