Can I print out a variable value in a SP for debugging?

Yes, if you do an ordinary SELECT inside a stored procedure or function, the result set is returned directly to the client. You will need to use the MySQL 4.1 client-server protocol for this to work. This means that, for instance in PHP, you need to use the mysqli extension rather than the old mysql extension.