I have an employees table which has a column of employee names. It looks like this:
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
I want to use a replace function so that the names of the employees become "Alxen," "Milxer" and "Mulxa." So that the second 'L' of the name is replaced with "X."
The answer to the question is simply to use regexp_replace(employee_name,'LL','LX',1,1). This will replace just the first occurrence of the LL pattern with LX. If he needs to replace all occurrences of LL (if multiples exist in the string), then use regexp_replace(employee_name,'LL','LX',1,0).
Dig Deeper on Using Oracle PL-SQL
Related Q&A from Karen Morton
Learn how to do simple SQL arithmetic operations without using the arithmetic operators.continue reading
One reader asks if it is the best practice to store a document inside an Oracle database.continue reading
One reader asks how to create and retrieve a binary large object (BLOB), and SQL expert Karen Morton gives some comprehensive advice and tips.continue reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.