MrB MrB - 27 days ago 19
MySQL Question

MySql set multiple variables from one select

I'm starting to pull my hair out here is something like this even possible?

DECLARE var1 int;
DECLARE var2 int;
DECLARE var3 int;
SELECT var1:=id, var2:=foo, var3:=bar from page WHERE name="bob";
CALL someAwesomeSP (var1 , var2 , var3 );


The above doesn't work but i am trying to figure out how I would accomplish this. My ultimate goal here is to call a select and than call stored proc with data from select.

Thanks

Zec Zec
Answer

Check out how it's being done here or here

I have not had much opportunity to code in MySQL, and SELECT...INTO is used in T-SQL to create a temp table on the fly. I was surprised to learn it has more functionality in MySQL.

Comments