I want to replace all the dots before @ in an email with empty string in oracle query
like:
anurag.mart@hotmail.com >> anuragmart@hotmail.com
Advertisement
Answer
- Instr – To identify the position(
@) - Substr – To extract data between start(
1) and end(@) position - Replace – To replace
.with'' - || – To concatenate two strings
Try this
SELECT Replace(Substr('anurag.mart@hotmail.com', 1,
Instr('anurag.mart@hotmail.com', '@', 1)), '.', '')
|| Substr('anurag.mart@hotmail.com', Instr('anurag.mart@hotmail.com','@')+1)
FROM dual
Result:
anuragmart@hotmail.com