I have a MySQL stored proc that is running locally on MySQL 8 but is failing on my managed MySQL on DigitalOcean. The proc contains dynamic sql being built as a variable (@query), then executed by the following:
prepare st from @query; execute st; DEALLOCATE PREPARE st;
The error I get states the following:
1054 - Unknown column ’ [… my sql from @query var …] ’ in ‘field list’
It is clearly treating the entire sql statement as a column name instead of a statement that must be executed. This is not what happens on a local MySQL install.
The exact same code runs locally. Is this a permission issue? Lack of rights to EXECUTE? Disabled dynamic SQL?