CONV, when used with a positive to_base, converts to an unsigned value, while BIGINT
is signed. An unsigned 64-bit value won't necessarily fit into a signed 64-bit variable.
If to_base is a negative number, N is regarded as a signed number. Otherwise, N is treated as unsigned.
What you want to do is use -10
for a destination base, that is;
set md5bigint1value = conv(substring((md5(mystring)),1,16),16,-10); -- line 3
SQLfiddle to test with (10 won't work, -10 will).