I have genarted a query through below stored procedure but is it possible to execute the query within the same procedure.
CREATE PROCEDURE ...
DYNAMIC RESULT SETS 1
DECLARE C1 CURSOR WITH RETURN ONLY FOR S1
SET SQLSTR = STM1 || STM2 || STM3;
PREPARE S1 FROM SQLSTR;
Output for above stored procedure is a query like >> SEL COL1,COL2 FROM DB.TAB1 so is there a way to change this procedure to generate as well as execute the query in it.
Solved! Go to Solution.
when i FETCH for the 2nd time into a variable then it overrides the value so could you please suggest how to use the 2nd cursor to get the complete query into another variable which i can execute.