DELIMITER $$;
DROP FUNCTION IF EXISTS `radius`.`fun_split`$$
CREATE DEFINER=`root`@`% ` FUNCTION `fun_split`(nm varchar(100)) RETURNS varchar(500) CHARSET latin1
Liest SQL-Daten
BEGINNEN
deklariere i int;
deklariere rtn int;
deklariere rtn1 int;
deklariere sec varchar(10);
deklariere rtnstr varchar(500);
setze i=1;
set rtnstr='';
WHILE i <length(nm) DO
set rtn= ascii(substring(nm,i,1));
WENN rtn>127 DANN
set rtn1= ascii(right(substring(nm,i,2),1));
WENN rtn1> 127 DANN
WENN i<Länge(nm)-1 DANN
WENN (ascii(right(substring(nm,i,3),1))>127 und ascii(right(substring(nm,i,4),1))>127) DANN
set sec=concat(right(concat('00',rtn-160),2),right(concat('00',rtn1-160),2),right(concat('00',ascii(right(substring (nm,i,3),1))-160),2),right(concat('00',ascii(right(substring(nm,i,4),1))-160),2),' ');
ANDERS
set sec='';
ENDE WENN;
ANDERS
set sec='';
ENDE WENN ;
ANDERS
set sec=concat(char(rtn),char(rtn1));
ENDE WENN;
SETze i = i + 1;
ANDERS
WENN i<Länge(nm)-1 DANN
WENN (ascii(right(substring(nm,i,2),1))>127 und ascii(right(substring(nm,i,3),1))>127) THEN
set sec=concat(char(rtn),'');
ANDERS
set sec=char(rtn);
ENDE WENN;
ANDERS
WENN (ascii(right(substring(nm,i,2),1))>127 und ascii(right(substring(nm,i,3),1))>127) THEN
set sec=char(rtn);
ANDERS
set sec=char(rtn,ascii(right(substring(nm,i,2),1)));
ENDE WENN;
ENDE WENN;
ENDE WENN;
set rtnstr=concat(rtnstr,sec);
SETze i = i + 1;
ENDE WÄHREND;
RETURN rtnstr;
END$$
DELIMITER ;$$