U0400007: EXECUTE cannot be used to execute a dynamic SELECT statement in a GaussDB stored procedure
Description
Database Type and Version
- Source database type and version: MySQL 5.5, 5.6, 5.7, and 8.0
- Target database type and version: all GaussDB versions
Syntax Example
This error is reported because UGO converts EXECUTE statements but does not convert dynamic SQL statements by default. You need to evaluate whether dynamic SELECT statements need to be executed.
If EXECUTE is used to execute dynamic SELECT statements in the GaussDB stored procedure, error U0400006 may be reported. For example:
CREATE PROCEDURE execute_dynamic_demo() AS DECLARE total INT; BEGIN SELECT count(1) INTO total FROM emp_t WHERE deptno = 10; EXECUTE IMMEDIATE 'SELECT total;'; END;
Suggestion
See U0400006: GaussDB does not support SELECT in a stored procedure.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot