Replace string in a column using query in Oracle

Tom Sebastian picture Tom Sebastian · Sep 6, 2013 · Viewed 32.7k times · Source

In one of my oracle tables, in one column in every row there is a string 'House Name'. I need to replace it with 'House Number'. Can I execute an update query to find and replace this string in all rows.Or is there any built in function for that.

Answer

Digital Alchemist picture Digital Alchemist · Sep 6, 2013

The following from Tech on the Net may help:

REPLACE('User House Name is ABC', 'House Name', 'House Number');

would return 'User House Number is ABC'

REPLACE('123tech123', '123'); would return 'tech'

REPLACE('222tech', '2', '3'); would return '333tech'

REPLACE('0000123', '0'); would return '123'

REPLACE('House Name', 'House Name', 'House Number'); would return 'House Number'