I want create table in mysql procedure like
DROP TABLE IF EXISTS a;
CREATE TABLE a AS SELECT * FROM (CALL(abcdef(abc)));
Any ideas how can I do it or it is impossible in mysql?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can’t use the syntax in your question, because a stored procedure doesn’t return anything (even though it can change the value of some of its parameters, if configured as
OUTorINOUT).I suggest the following:
modify the procedure to store the rows in a temporary table:
After the procedure call, either use directly the table
temp_table(SELECT ... FROM temp_table), or execute the following query:when you no longer need it, you may drop the temporary table. Otherwise, it will be automatically dropped when the MySQL connection is closed.