I have created the below function in mysql:
DELIMITER $$
CREATE FUNCTION fn_header_uploader_address(v_add varchar(500)) RETURNS bigint(20)
begin
DECLARE v_error bigint default 0;
IF length(v_add) > 100 then
set v_error = 110;
elseif v_add is null or v_add ='' then
set v_error=110;
elseif v_add NOT REGEXP '^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$' then
set v_error=110;
end if;
return v_error;
end$$
DELIMITER ;
If I run it on local (deterministic/no deterministic clause) , it returns zero (valid email) for the below statement:
select fn_header_uploader_address('hello@gmail.com');
but on moving the function to a new server, this become case sensitive !! So now
select fn_header_uploader_address('hello@gmail.com'); ---- error 110
Any help please ?
Edit:
I have already compared the servers using the below commands:
show collation where collation like '%_c%' ;
show variables like '%version%';
Change:
...
elseif v_add NOT REGEXP '^[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$' then
...
or binary:
...
elseif v_add NOT REGEXP '^[\x41-\x5a\x61-\x7a\x30-\x39\x2e\x2d\x5f\x25]+\x40[\x41-\x5a\x61-\x7a\x30-\x39\x2e\x2d]+\x2e[\x41-\x5a\x61-\x7a]{2,4}$' then
...