Re: cuantas inserserciones se hicieron en una tabla

From: Julio Cesar Rodriguez Dominguez <jurasec(at)gmail(dot)com>
To: Miguel Angel Hernandez Moreno <miguel(dot)hdz(dot)mrn(at)gmail(dot)com>
Cc: Lista PostgreSql <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Re: cuantas inserserciones se hicieron en una tabla
Date: 2010-07-07 20:41:15
Message-ID: AANLkTinxXXbMRR0u4F0hQ3Mu8QbJe0wKM8VfhCu--vVl@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

El 7 de julio de 2010 14:58, Miguel Angel Hernandez Moreno <
miguel(dot)hdz(dot)mrn(at)gmail(dot)com> escribió:

> Hola lista
>
> disculpen me salio la necesdad de saber cuantos registros feron insertado
> usando un insert into
> de hecho lo tengo en una funcion que hace una busqueda a una tabla e
> inserta los datos
> pero no se cuantos datos me inserta, si alguien me pudiera ayudar se lo
> agradeceria mucho.
>
> esta es la funcion que uso para alinear las tablas. solo quiciera que la
> funcion me retornara
> cuantas inserciones se hicieron
>
> CREATE OR REPLACE FUNCTION procmty.alinearb(character varying, character
> varying)
> RETURNS integer AS
> $BODY$
> DECLARE
> nombre_tabla text:='';
> solofecha text:='';
> recibo1 timestamp:= NOW()::timestamp;
> BEGIN
> --select NOW()::timestamp+interval '1 day' into recibo;
> select 'cadenas2_'||substr(recibo1::text,1,4)
> ||'_'||substr(recibo1::text,6,2) ||'_'||
> substr(recibo1::text,9,2) into nombre_tabla;
>
> EXECUTE 'insert into procmty.'||nombre_tabla||'
> (cadena, id , recibo, puerto, fecha, pid,linea ,fecha2, enviado) (
> SELECT * FROM dblink(''host=207.249.166.212 dbname=feria3'',
> ''SELECT cadena, id , recibo, puerto, fecha, pid,linea ,
> fecha2, enviado FROM procmty.'||nombre_tabla||' where
> recibo>='''' '||$1||' '''' and recibo<='''' '||$2||' '''' '')
> AS t(cadena text, id character varying, recibo timestamp,
> puerto integer, fecha timestamp, pid integer,linea integer,
> fecha2 timestamp, enviado integer)
> where (t.id,t.recibo::timestamp without time zone)::varchar not in (
> select (id,recibo::timestamp without time zone)::varchar
> from procmty.'||nombre_tabla||' where recibo>='' '||$1||' '' and
> recibo<='' '||$2||' '') )';
>
>
> RETURN NULL;
> END;
> $BODY$
> LANGUAGE 'plpgsql' VOLATILE
> COST 100;
>
> Gracias
>

Puedes usar: get diagnostics no_rows = ROW_COUNT;

In response to

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Dianna Florencia Romero Berrospi 2010-07-07 21:52:08 Sacar correctamente Backup Base de Datos en Windows
Previous Message Miguel Angel Hernandez Moreno 2010-07-07 19:58:20 cuantas inserserciones se hicieron en una tabla