MySQL Forums
Forum List  »  UDF

MySQL Function works on local MySQL but not on server!
Posted by: John Coombs
Date: October 14, 2016 11:50AM

I have a function that works on my local MySQL database but does not return the same value on the public server. I am not sure why. I am using UTF-8. The parameter is an integer (Keyval). The idea is to take Keyval: 216 and convert it to '‚‚„ƒˆ', where they are characters: 130,130,132,131,136 thru: MakeAltAbbr(216)

UPDATE `cc_team` SET `AltTMAbbr`= MakeAltAbbr(TeamKey) WHERE TeamKey = 216;

On localhost it creates some special characters, on the server it is 'blank'.

BEGIN
DECLARE cc CHAR(5);
DECLARE str CHAR(5);
DECLARE x INT default 0;
DECLARE y INT default 0;
SET str = '';
SET x = 1;
SET cc = LPAD(Keyval,5,'0');
SET y = LENGTH(cc);

WHILE x <= y DO
SET str = CONCAT(str,CHAR(SUBSTRING(cc,x,1) + 130));
SET x = x + 1;
END WHILE;

RETURN str;
END

Options: ReplyQuote


Subject
Views
Written By
Posted
MySQL Function works on local MySQL but not on server!
765
October 14, 2016 11:50AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.