Replace last occurrence of substring
问题 Given this string: .ABC,.123,.FGH,.QDG How can I most-efficiently use PL/SQL to output (note the ", and"): abc, 123, fgh, and qdg So far I've got LOWER(REPLACE('.ABC,.123,.FGH,.QDG', '.', ' ')) , which yields abc, 123, fgh, qdg How do I get that "and" after "fgh,", but before "qdg" ("fgh, and qdg")? Must I use INSTR() and SUBSTR() , or is there a function that can just replace the last space with " and "? 回答1: Building on what you used already... use regexp_replace with instr with cte as(