dynamic cursors in mysql

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

I have a problem in writing a dynamic cursor

CREATE PROCEDURE testassign(IN testdb varchar(50))
DECLARE a varchar(50);
DECLARE b varchar(50);
set @tab1 = "SELECT test1,test2 FROM testdb.testtable;";
DECLARE curtest CURSOR FOR @tab1
OPEN curtest;
FETCH curtest INTO a, b;
CLOSE curtest;
SELECT a ,b ;

actually the purpose of me writing this dynamic cursor is i will get
the database name as a input parameter and my cursor should select the
data accordingly.

but im not able to do the same. can anyone help me out with different

Site Timeline