New to SQL and trying to run this code and I get the error "#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '@Qtable TABLE(Qid INT) END' at line 3". The code runs fine if I take out the DECLARE
statement;
SET @query_id = (SELECT ID from ua820988_dev.users WHERE `email` = 'example@gmail.com');
CREATE PROCEDURE query_requests()
BEGIN
DECLARE @Qtable TABLE(Qid INT)
END;
SELECT * from ua820988_dev.requests WHERE `match` = @query_id;
SELECT * from ua820988_dev.requests_archive WHERE `match` = @query_id;
I'm hoping to eventually put the results from the 2nd and 3rd SELECT
statements into the table, but this is the watered down version for now just trying to get the code to run. I'm running SQL 5.6 on MariaDB 10.2.