Hi Bimal, On Fri, Dec 22, 2023 at 10:28 AM bimal maity <bimal.af2020@xxxxxxxxx> wrote: > I have below query used in Oracle but while migrating to Postgres this code is not supported in Postgres. I didn't try your query, but I guess it complains about RTRIM, because it should accept text as an argument. If it is a case, you can try to dig in direction of something like this: > SELECT p.id_po, p.line_number, replace(replace(replace(RTRIM(XMLAGG(XMLELEMENT(name C, regexp_replace(p.protocol_number,'([[:cntrl:]])','', 'g'))ORDER BY 1)::text (with explicit type casting) best regards, Ilya -- Ilya Kosmodemiansky CEO, Founder Data Egret GmbH Your remote PostgreSQL DBA team T.: +49 6821 919 3297 ik@xxxxxxxxxxxxx