Search Postgresql Archives

my first procedure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



folks 

 i´ts is my first procedure/function 
 the pgadmin show 10 secs in execute it

 any pointer  be apreciated

 
CREATE OR REPLACE FUNCTION fs_getstring() RETURNS TEXT
 AS ' 
DECLARE 
    DECLARE
       curs1 CURSOR FOR  select id_reparticion
::varchar  || chr(1) ||  codigo_reparticion ::varchar 
 || chr(1)  ||
 codigo_repar_inter ::varchar || chr(1) ||
nombre_reparticion ::varchar  || chr(1) ||
vigencia_desde ::varchar   
|| chr(1) || vigencia_hasta  ::varchar  ||  chr(1) ||
id_calle_repar ::varchar || chr(1) || numero ::varchar
|| chr(1) || piso ::varchar || 
chr(1) || oficina ::varchar || chr(1) ||  telefono
::varchar || chr(1) ||  fax ::varchar || 
chr(1) || email ::varchar || chr(1)  || 
codigo_estructura ::varchar  || chr(1) ||
repart_presentismo ::varchar || chr(1) || 
id_reparticion_ext ::varchar || chr(1)  ||
proximo_remito ::varchar  || chr(1) || en_red
::varchar || chr(1) || 
sector_mesa ::varchar  || chr(255) ::text
 from repartit;
    v_buffer TEXT ; 
    v_var   TEXT  ;	

    
BEGIN 
       v_var = ''''  ;   		
       open curs1 ;
		
       FETCH curs1 INTO v_buffer  ;	
       WHILE ( FOUND ) LOOP
            v_var = v_var ||  v_buffer ;
	 FETCH  curs1 INTO v_buffer  ;	
       END LOOP; 
     close curs1 ; 			
      RETURN v_var; 
END 
' LANGUAGE 'plpgsql';

  
 the statement 
   v_var = v_var ||  v_buffer ;
 allocate memory dynamically , i think this is problem

 any clue?

 best regards 
  MDC 



	
	
		
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux