Skip site navigation (1) Skip section navigation (2)

Re: rarezas

From: marcelo Cortez <jmdc_marcelo(at)yahoo(dot)com(dot)ar>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: rarezas
Date: 2007-12-19 18:11:19
Message-ID: 947250.22669.qm@web32111.mail.mud.yahoo.com (view raw or flat)
Thread:
Lists: pgsql-es-ayuda
Alvaro 

--- Alvaro Herrera <alvherre(at)commandprompt(dot)com>
escribió:

> marcelo Cortez escribió:
> > Gente 
> > 
> > el siguiente codigo no genera la tabla en
> cuestion.
> > si lo pego en el pgadmin y lo ejecuto ..si tengo
> la
> > tabla!..
> 
> Y el resto del codigo?
 
Lo mande con con codigo !, algun error en el envio--
te mando el codigo.

-- Function: loadall2()

-- DROP FUNCTION loadall2();

CREATE OR REPLACE FUNCTION loadall2()
  RETURNS void AS
$BODY$

/* variables de v_1 */

declare v_rmarca character varying(100);
declare v_clase character varying(2);
declare v_agte character varying(4);
declare v_acta character varying(50);
declare v_reso_nro character varying(10);
declare v_acta character varying(50);
declare v_bmarca character varying(100);
declare v_bacta character varying(7);
declare v_titular character varying(50);
declare v_cobertura character varying(1);
declare v_nbol numeric;
declare v_carpeta character varying(10);
declare v_nombre character varying(180);
declare v_origen integer;

/* variable de boletindbf */

DECLARE b_marca character varying(100) ;
declare b_clase  character(200) ; 
declare b_activo boolean;
declare b_acta character(7);
declare b_agte character(4) ;
declare b_cobertura character(1);
declare b_tmarca character(1);
declare b_pais character(2);
declare b_titular character(50);
declare b_nbol integer ;
declare b_fpres timestamp ;
declare b_fpublic timestamp;


DECLARE
    bcursor  CURSOR FOR SELECT
activo,marca,clase,acta,agte,cobertura,tmarca,pais,titular,nbol,fpres,fpublic

			FROM boletindbf where btrim(agte) != '438';

DECLARE ecursor  CURSOR FOR select 1 
	from pg_tables where schemaname ='public' and 
tablename = 'v_11' ;    

declare buffer character(200);
declare lexist boolean = false ;
declare p int ;
BEGIN

    OPEN ecursor;
    FETCH  ecursor into p;
    
    
    if p is null then
	raise info 'create  table v_11';
	begin 
        CREATE TABLE v_11(rmarca character
varying(100),
		clase character varying(2),
		agte character varying(4),
		racta character varying(50),
		reso_nro character varying(10),
		acta character varying(50),
		bmarca character varying(100),
		bacta character varying(7),
		titular character varying(50),
		cobertura character varying(1),
		nbol numeric,
		carpeta character varying(10),
		nombre character varying(180),
		origen integer) ;
	end ;	
  	else
		raise info 'Truncate table v_11';
		 truncate table v_11 ;
		 
	end if 	;
    close ecursor;
    OPEN bcursor; /* boletindbf */
	fetch  bcursor into
b_activo,b_marca,b_clase,b_acta,b_agte,b_cobertura,b_tmarca,b_pais,b_titular,b_nbol,b_fpres,b_fpublic
 ;
	
    WHILE FOUND  LOOP
	IF b_marca is not  NULL then
	/* copio las variables que lei de boletin al v_11 */
	 /* insertamos en la tabla mulelto dwe v_1 */
	 
	v_clase = b_clase  ;
	v_agte = b_agte ;
	v_bmarca = b_marca ;
	v_bacta = b_acta  ;
	v_titular=b_tmarca ;
	v_cobertura=b_cobertura;
	v_nbol=b_nbol ;
	v_origen= 7 ;
         select  
public.cargatokens(b_activo,b_marca,b_clase,b_acta,b_agte,b_cobertura,b_tmarca,b_pais,b_titular,b_nbol,b_fpres,b_fpublic);
	END IF ;
	
	fetch  bcursor into
b_activo,b_marca,b_clase,b_acta,b_agte,b_cobertura,b_tmarca,b_pais,b_titular,b_nbol,b_fpres,b_fpublic
 ;
     END LOOP  ;    
     close bcursor ;
     return ; 	
END;
$BODY$
  LANGUAGE 'plpgsql' VOLATILE
  COST 100;
ALTER FUNCTION loadall2() OWNER TO postgres;
 


> 
> -- 
> Alvaro Herrera                               
> http://www.CommandPrompt.com/
> PostgreSQL Replication, Consulting, Custom
> Development, 24x7 support
> --
> TIP 4: No hagas 'kill -9' a postmaster
> 


      Yahoo! Encuentros.

Ahora encontrar pareja es mucho más fácil, probá el nuevo Yahoo! Encuentros http://yahoo.cupidovirtual.com/servlet/NewRegistration

In response to

  • Re: rarezas at 2007-12-19 16:54:04 from Alvaro Herrera

pgsql-es-ayuda by date

Next:From: marcelo CortezDate: 2007-12-19 18:17:40
Subject: Re: Re[2]: script backup linux
Previous:From: Jenaro Centeno GomezDate: 2007-12-19 18:10:49
Subject: Re: llamar funciones ..muy confuso

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group