How to replace specific values in a oracle database column? How to replace specific values in a oracle database column? sql sql

How to replace specific values in a oracle database column?


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')


If you need to update the value in a particular table:

UPDATE TABLE-NAME SET COLUMN-NAME = REPLACE(TABLE-NAME.COLUMN-NAME, 'STRING-TO-REPLACE', 'REPLACEMENT-STRING');

where

  TABLE-NAME         - The name of the table being updated  COLUMN-NAME        - The name of the column being updated  STRING-TO-REPLACE  - The value to replace  REPLACEMENT-STRING - The replacement


In Oracle, there is the concept of schema name, so try using this

update schemname.tablename tset t.columnname = replace(t.columnname, t.oldvalue, t.newvalue);