This query tested by me today.
Same result, online, cursor dosn't need.
You can use it, if you want.
with Persons (person_id, v) as
(
select varchar('0001', 50), varchar('A1', 50)
from sysibm.sysdummy1
union all
select '0001', 'A3'
from sysibm.sysdummy1
union all
select '0002', 'A1'
from...