How to Replace Specific Value in Oracle DB Column

Personally, I do always use the replace functionally in Windows Notepad in my daily works. It is a simple and very fast approach.

But, how do you deal with Oracle database query?

Taking an example on below query result (TRKORR is the table for SAP transport request)

SQL> select TRKORR from SAPSR3.E070;

TRKORR
------------------------------------------------------------
DEVK900001
DEVK900002
DEVK900003
DEVK900004
DEVK900005
DEVK900006
DEVK900007

So, here – you want to change the value DEVK into QASK. The numbers will remain the same.

update SAPSR3.E070 set TRKORR = replace (TRKORR, 'DEVK', 'QASK');
SQL> select TRKORR from SAPSR3.E070;

TRKORR
------------------------------------------------------------
QASK900001
QASK900002
QASK900003
QASK900004
QASK900005
QASK900006
QASK900007

Reference

update TABLE-NAME set COLUMN-NAME = replace(COLUMN-NAME, 'OLD-NAME', 'NEW-NAME');

TABLE-NAME : The table name.
COLUMN-NAME : The column name
OLD-NAME : The old value
NEW-NAME : The new value

You May Also Like

Leave a Reply?