I'm new to MySQL, I'm trying to store sql statement into variable:
SET @sql = 'SELECT * FROM tbl_tableName';
SELECT @sql;
It executes correctly, and give me result:
But how can see the result of the sql statement stored in that variable? If I'm execute it, it gives an error.
SET @sql = 'SELECT * FROM tbl_defects';
SELECT @sql;
PREPARE stmt FROM @sql;
EXECUTE stmt;
error:
Fatal error: Uncaught Error: Call to a member function getClauses() on null in /opt/lampp/phpmyadmin/vendor/phpmyadmin/sql-parser/src/Utils/Query.php:567 Stack trace: #0
Please any one help me to execute the sql statement stored in variable (Want to execute/check the result stored in that variable. I know we can directly run and check the result in SQL prompt)?
