当前位置: 代码迷 >> MySQL >> navicat for mysql创造自定义函数
  详细解决方案

navicat for mysql创造自定义函数

热度:474   发布时间:2016-05-05 16:31:53.0
navicat for mysql创建自定义函数



?

?



??


?
?

?


?
?

BEGIN	#Routine body goes here...	DECLARE Result varchar(4000);	DECLARE v_acc_menuid varchar(400);	DECLARE flag INT;	DECLARE	a	varchar(200);  DECLARE menu_cursor CURSOR for 	select t.menuid from w_manager_rolemenu t where t.roleid =roleid ORDER BY t.menuid;	DECLARE CONTINUE HANDLER FOR NOT FOUND SET flag=1;		SET flag=0;		SET Result='';    OPEN menu_cursor;    REPEAT  /*循环*/		FETCH menu_cursor INTO v_acc_menuid;				IF (Result='') THEN					SET Result=v_acc_menuid;				ELSE          SET a=CONCAT("#_",v_acc_menuid);					SET Result=CONCAT(Result,a);				END IF;		UNTIL flag		END REPEAT;		CLOSE menu_cursor ;		#SET Result=substr(Result,3,length(Result));		SELECT SUBSTR(Result,1,(LENGTH(Result)-(LENGTH(substring_index(Result,'#_',-1))+2))) INTO Result;  RETURN(Result);END

?

  相关解决方案