Log in

View Full Version : Setting result of Prepare Statement in MySQL



Smitha25
04-15-2009, 05:25 AM
Hi,

I want to assign the output of the prepared statement into OUT variables( i want to pass the result as output of the procedure).I am attaching the procedure.Any hint will be very helpful to me.


CREATE PROCEDURE `spark`.`proc_GetSortedIdeas` (IN tbl1 varchar(1000),IN tbl2 varchar(1000),IN tbl3 varchar(1000))
READS SQL DATA
BEGIN
SET @s = concat(tbl1,' ',tbl2,' ',tbl3,';');

// I want to get the output of this statement into variable

PREPARE stmt FROM @s;
EXECUTE stmt;
END $$

thanks in advance,

Smitha