?
?
??
?
?
?
?
?
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
?