How to loop through the xml array. Here is the following code which I tried.
for c in select (unnest((xpath('//PayTypes/@value', ('<dummy_root><IncludeSettle/><StartTime value="2019-03-26 08:45:48.780"></StartTime><PayTypes value="1"/><PayTypes value="2"/></dummy_root>')::xml)))::text)
loop
raise notice '%', c;
end loop;
I am getting back the following error saying below:
ERROR: loop variable of loop over rows must be a record variable or list of scalar variables
LINE 11: for c in select (unnest((xpath('//PayTypes/@value', ('<dummy...
Any help is really appreciated. Output I am expecting is printing values 1, 2.