Solved

How can I replace a particular string pattern in a word

Posted on 2013-06-25
3
229 Views
Last Modified: 2013-06-25
I have a coumn which can have values ‘aw45t/P76/002’, ‘aw45t/P54/002’,
I will like to replace any occurrence of /P##/ with /P99/

DB: Oracle 10g
0
Comment
Question by:diteps06
3 Comments
 
LVL 74

Accepted Solution

by:
käµfm³d   👽 earned 300 total points
Comment Utility
Try:

UPDATE table
SET column = REGEXP_REPLACE(column, '/P[0-9][0-9]/', 'P99');

Open in new window

0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
Comment Utility
Typo correction and small alternative change:
REGEXP_REPLACE(column,'/P[0-9]{2}/', '/P99/')
0
 
LVL 1

Author Comment

by:diteps06
Comment Utility
Thanks for the fast and precise answer
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now