How to write concat query for multiple 'select into' statement in mysql stored procedures? I am trying to assign values to variables in mysql stored procedures. Here is my code
declare count int;
declare ParamOrgId int;
declare isPremium int;

SET @sql = CONCAT(' select count(id) , orgid , (select id from org_subscription t where t.orgid=mainOrgID)  into ', @count,',',ParamOrgId ,',',isPremium ,' '
 from ', tableA );

PREPARE stmt from @sql;
EXECUTE stmt ;


SELECT concat('my val is ', ParamOrgId);
END
SIMPLY use user defined variales instead of variables.
CREATE PROCEDURE `new_procedure` (IN tableA varchar(255))
BEGIN
SET @sql = CONCAT(' select count(id) , orgid , (select id from org_subscription t where t.orgid=mainOrgID)  into @count,@ParamOrgId ,@isPremium  from ', tableA );

PREPARE stmt from @sql;
EXECUTE stmt ;


SELECT concat('my val is ', @ParamOrgId);
END

But this only works if you get only 1 result row. IF you want more, you need a Loop