How to Replace Specific Value in Oracle DB Column



Share this article :

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

Related posts

Oracle Database Process Structure
ORA-28000: the account is locked
ORA-27101: shared memory realm does not exist
ORA-32001: write to SPFILE requested but no SPFILE is in use
© 2017 ITsiti. All Rights Reserved
Powered by KEEM