How to create function using another functions mysql
Instead of DROP + CREATE, simply do TRUNCATE TABLE.  That should avoid the error about COMMIT.

Drawback:  Other code would need to originally do the CREATE and DROP.