locked
SQL Query with variable name table in Stored Procedure using MySql 8 version RRS feed

  • Question

  • User-1453200658 posted

    Hi,

    This is my SQL query that working correctly and it's stored an a database MySql version 8.0.17

    (I'm sorry but if I'm paste the query code the question is not posted... does anyone know why?)

    enter image description here

    I've tried using this SQL query on an a Stored Procedure on this mode

    (I'm sorry but if I'm paste the stored procedure code the question is not posted... does anyone know why?)

    enter image description here

    But I've this error

    Procedure execution failed 1146 - Table 'db_test.',tablename,'' doesn't exist Time: 0,138s

    I've tried with this question without success

    Any help would greatly appreciate... Thank you.

    Friday, April 9, 2021 8:02 PM

Answers

  • User269602965 posted

    after you set tablename, print the variable to screen from the procedure to see if you have created the correct value and valid table name.

    If it is as expected, then you may have punctuation issue in the SQL statement after that.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, April 10, 2021 1:03 AM