MySQL Forums
Forum List  »  Newbie

Re: Table-valued parameters to a stored procedure
Posted by: Scott Klein
Date: December 10, 2021 05:51PM

Thanks Jon,

I've read about the group_contat function...I'm having trouble getting it to work with a variable instead of selecting from a table. Is this possible, using @data instead of "select from data" as in the example below?

set @data = '1,2,3,4,5,6,7,8,9';

CREATE TEMPORARY TABLE items(item text );

set @sql = concat("insert into items (item) values ('", replace(( select
group_concat(distinct txt) as data from t), ",", "'),('"),"');");

prepare stmt1 from @sql;
execute stmt1;
select item from items;

Options: ReplyQuote


Subject
Written By
Posted
Re: Table-valued parameters to a stored procedure
December 10, 2021 05:51PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.