REPLACE PROCEDURE MyDataBName.sp1 (IN parIn1 VARCHAR(100), OUT par1 VARCHAR(30), OUT Par2 VARCHAR(30)) BEGIN DECLARE CurStr VARCHAR(500); DECLARE projcursor CURSOR FOR S1; SET CurStr = MyQuery; PREPARE S1 FROM CurStr; OPEN projcursor; Label1: LOOP FETCH projcursor INTO par1, par2; IF (SQLSTATE = '02000') THEN LEAVE label1; END IF; END LOOP label1; CLOSE projcursor; END;
MyQuery contains the select statement with "where" clause. I m using LIKE to fliter the records base on parIn1 .
Thanks
Forums: