Hi,
I am used to declaring cursors as follows:
Code:
DECLARE cursor1 CURSOR FOR SELECT col1 FROM myTable;
I have a very large sql select statement stored as a stored procedure. Is it possible to declare a cursor and set its value from a stored procedure as follows:
Code:
DECLARE cursor2 CURSOR FOR CALL StoredProc(v_col1);
I dont want to re-write the entire select statement again if its already stored in a stored procedure - StoredProc(v_col1). However the above syntax throws an error. I cant find anything in the MySQL doc or online regarding this so I was wondering if any one here had any knowleged if this is possible.