Hi ,here is another issue now. If you see the last value in the source table it considers commas as separate columns and gives errors. Can you please help?
Please don't top-post. Also, take the time to remove anything not necessary to provide useful context.
The only help I can give is to reiterate that trying to do string concatenation and writing out text literals for arrays and composites is something that should just be avoided. If you cannot, learn the quoting and escaping rules for the thing you are trying to build and obey them.