calculate distance

calculate distance - MySQL stored function