Hello,
since I had some trouble to call the same SQL-Procedure via PHP AND via SQL here is small Sample which shows how I solved that nasty issue.
EDIT: SINCE THAT AUTO PARSE FUNCTION DESTROYS EVERYTHING I replaced CODE tags with QUOTE and added pastebin containers: @
MrSm!th would be cool to fix this issue asap...
Whole Procedure
http://pastebin.com/KWTXxQGD
SQL and PHP CALL
http://pastebin.com/yz2XYt3g
...