Input:
ABC DEF GHIJ123A KLM GHIJ456B RST UVW GHIJ789C
Ouput:
ABC DEF GHIJ000X KLM GHIJ000X RST UVW GHIJ000X
So, I want to find all instances of words in the string that start with GHIJ
and replace the entire word with GHIJ000X
.
How can I achieve this in Oracle SQL?
New contributor
Vani Narayana is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
You can do it like that:
SELECT REGEXP_REPLACE(
'ABC DEF GHIJ123A KLM GHIJ456B RST UVW GHIJ789C',
'GHIJw*',
'GHIJ000X'
) AS replaced_string
FROM dual;