From: | Miguel Angel Hernandez Moreno <miguel(dot)hdz(dot)mrn(at)gmail(dot)com> |
---|---|
To: | Julio Cesar Rodriguez Dominguez <jurasec(at)gmail(dot)com> |
Subject: | Re: cuantas inserserciones se hicieron en una tabla |
Date: | 2010-07-07 22:22:46 |
Message-ID: | AANLkTil-DGCyYRsEWB_rSwaEnryvnpy6ZZ-GmavsTJTc@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
gracias ya lo probe y me funciono muy bien!!!
CREATE OR REPLACE FUNCTION procmty.alinearb(character varying, character
> varying)
> RETURNS integer AS
> $BODY$
> DECLARE
> nombre_tabla text:='';
> solofecha text:='';
> recibo1 timestamp:= NOW()::timestamp;
> *no_rows int;
> ----------------------------------------------------------------------------
> *
>
> 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||' '') )';
>
> *get diagnostics no_rows = ROW_COUNT;
> -------------------------------------------------*
> *
> * RETURN *no_rows*;
> -------------------------------------------------------
>
> END;
> $BODY$
> LANGUAGE 'plpgsql' VOLATILE
> COST 100;
>
From | Date | Subject | |
---|---|---|---|
Next Message | glana | 2010-07-08 08:21:43 | Re: crosstab: ERROR: invalid return type |
Previous Message | Julio Cesar Rodriguez Dominguez | 2010-07-07 22:05:25 | Re: Sacar correctamente Backup Base de Datos en Windows |