I am having two arrays. Both array calculated from functions so both arrays are dynamic but length of both arrays will be same.
a1= ARRAY[1,2,3];
a2= ARRAY[10,20,30];
Now I want to update my table something like this
UPDATE TABLE SET data= CASE
data=a1[1] then a2[1]
data=a1[2] then a2[2]
data=a1[3] then a2[3]END
where id=1;
I tried with adding loop inside CASE but it is not working .