Alex Rivera | Logout

How to replace specific values in a oracle database column?

Asked 2010-08-09T18:47:14.713
79

I am looking to replace values in a particular column. For example the following column values

column name
----------
Test1
Test2
Test3
Test12

should be (replacing est1 with rest1)

column name
----------
Trest1
Test2
Test3
Trest12
Edit
Report

1 Answer

220

Use REPLACE:

SELECT REPLACE(t.column, 'est1', 'rest1')
  FROM MY_TABLE t

If you want to update the values in the table, use:

UPDATE MY_TABLE t
   SET column = REPLACE(t.column, 'est1', 'rest1')
answered 2010-08-09T18:49:54.923

Your Answer