List:Spanish« Previous MessageNext Message »
From:COMPINA Gabriel Date:October 6 2009 5:05pm
Subject:necesito ayuda
View as plain text  
hola man tengo  una funcion cuyo codigo es el siguiente




delimiter  ||
drop FUNCTION if exists fn_purchased;
CREATE  FUNCTION fn_purchased(id int) RETURNS varchar(300)
BEGIN 
DECLARE done INT DEFAULT 0; 
DECLARE VRETURN varchar(30) ; 
DECLARE us varchar(30); 
DECLARE users varchar(300) default ''; 
declare xx int default 0;
DECLARE UAM CURSOR FOR select distinct d.destino from deal_destinos dd
inner join destinos d on d.iddestino=dd.iddestino
where dd.iddeal=id ; 
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1; 
OPEN UAM; 
REPEAT 
FETCH UAM INTO us; 
 set xx=xx+1;
 set VRETURN=us;
  if(users='') then set users=concat(VRETURN,' (',xx,') ');
   else 
     if(substring(users,1,VRETURN) )!=VRETURN then
      set users=concat(users,' - ',VRETURN,' (',xx,') ');
  end if;  
  end if;   
UNTIL done END REPEAT; 
CLOSE UAM; 
RETURN users; 
END ;
||
delimiter ;


bueno puede ser k a simple vista este bien pero no  ya k  hay datos k se repiten  y esa no
es la idea 
aca dejo el resultado de dicho  codigo  esperando k me puedas ayudar desde  gracias y mi
correo es sdarknot@stripped

+-------------------------------------------------------------------------------------------+
| fn_purchased(1)                                                                         
 |
+-------------------------------------------------------------------------------------------+
|  ORLANDO 4/3 (1)  -  LAS VEGAS 3/2 (2)  - DAYTONA BEACH 3/2 (3)  - DAYTONA BEACH 3/2 (4)
 |
+-------------------------------------------------------------------------------------------+
1 row in set (0.02 sec)
Thread
necesito ayudaCOMPINA Gabriel7 Oct
  • necesito ayudadarkx hardy7 Oct
    • Re: necesito ayudaCalabaza7 Oct
  • Re: necesito ayudaJose B7 Oct
Re: necesito ayudaCalabaza7 Oct
Re: necesito ayudaCalabaza7 Oct
  • Error MySQLBinLog con Log de esclavoAna Carmona28 Oct
    • Re: Error MySQLBinLog con Log de esclavoewen fortune28 Oct
      • Re: Error MySQLBinLog con Log de esclavoAna Carmona29 Oct