http://www.mysqltutorial.org/mysql-cursor/