Control Flow Function In Mysql