I have a simple mysql procedure which must return an query string. But, it returns almost every time QueryResult
(column name) as <null>
value.
create procedure return_table_rename_query(
IN targetTable VARCHAR(100),
IN tblPrefix VARCHAR(100)
)
BEGIN
SET @returnQuery = CONCAT('SELECT "MYSQLIMPORT can not rename table for target ', @targetTable, '";');
SET @totalRows = (SELECT COUNT(*) FROM table);
if IFNULL(@totalRows, 0) > 0
then
SET @returnQuery = CONCAT('drop table if exists table_name.', ...);
end if;
SELECT @returnQuery AS 'QueryResult';
end;