I have formed the following QString statement to work as a stored procedure to query a DB:
Qt Code:
  1. DROP PROCEDURE IF EXISTS mprocedure;
  2. CREATE PROCEDURE mprocedure()
  3. BEGIN DECLARE EXIT HANDLER FOR SQLEXCEPTION
  4. BEGIN ROLLBACK;
  5. RESIGNAL;
  6. SHOW ERRORS;
  7. END;
  8. START TRANSACTION;
  9. SELECT primaryKey FROM m_schema.`persons_data` where `Name En` = 'jhone' and `date` = '2019-03-09' and `person type` = '3' and `persons_data`.`ID` in (SELECT foreignKey FROM m_schema.`employees` where ` m_date` = '2019-03-09')
  10. commit;
  11. END;
To copy to clipboard, switch view to plain text mode 
When I try to call the procedure by :
the following error occurred:
QSqlError("1305", "QMYSQL: Unable to execute query", "PROCEDURE m_schema.mprocedure does not exist")
And if i try to directly execute the same query without using the stored procedure, it executes correctly,
Qt Code:
  1. QSqlQuery::exec(SELECT primaryKey FROM m_schema.`persons_data` where `Name En` = 'jhone' and `date` = '2019-03-09' and `person type` = '3' and `persons_data`.`ID` in (SELECT foreignKey FROM m_schema.`employees` where ` m_date` = '2019-03-09'))
To copy to clipboard, switch view to plain text mode 
what is the problem with the first method?