Question

Dynamic SQL failing on DigitalOcean managed MySQL, while working locally on a dev MySQL 8 db.

Posted September 6, 2020 150 views
MySQLDigitalOcean Managed MySQL Database

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?

Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!