Sorted group_concat in procedure

GROUP_CONCAT (emp_id ORDER BY ord_id SEPARATOR’, ') is not working as expected in the procedure ?

Could you please provide a repro?

create table codes(code char(1), code_idx int(11));

insert into codes(code, code_idx) values

select group_concat(code order by code_idx SEPARATOR ‘’) from codes ;


delimiter //

create or replace procedure example_proc() returns void AS


str query(a text) = select group_concat(code order by code_idx SEPARATOR ‘’) from codes ;
final_str text;


final_str = scalar(str);

echo select final_str as t_;

delimiter //

call example_proc();


Hope this helps!

This is a known bug which we are tracking internally.

The issue is specifically with using GROUP_CONCAT() with Query Type Variables inside Stored Procedure. SCALAR() and COLLECT() built-in use Query Type Variables behind the scenes.

We will let you know once we have released a version with fix for this issue included.

@Saksham Was this issue resolved? I tried the group_concat in TVF its not working, producing the same issue as mentioned above

It’s fixed on 7.0.23+ / 7.1.7+ / 7.3