Hello all
What is the appropriate syntax for declaring a cursor for a table name that is passed as a parameter to a procedure? I tried several combination and it doesn't seem to work.
CREATE PROCEDURE PROC(tableName varchar(50))
BEGIN
DECLARE cursorName CURSOR FOR SELECT column1,column2 FROM tableName;
END
The select statement can not be a variable, also it's not working with PREPARE statement.
Can anyone help me on this matter?
Thanks in advance :)
What is the appropriate syntax for declaring a cursor for a table name that is passed as a parameter to a procedure? I tried several combination and it doesn't seem to work.
CREATE PROCEDURE PROC(tableName varchar(50))
BEGIN
DECLARE cursorName CURSOR FOR SELECT column1,column2 FROM tableName;
END
The select statement can not be a variable, also it's not working with PREPARE statement.
Can anyone help me on this matter?
Thanks in advance :)
Comment