Create a new table regexp_temp
CREATE TABLE regexp_temp(empName varchar2(20), emailID varchar2(20))
Table created.
Populate the regexp_temp table
INSERT INTO regexp_temp (empName, emailID) VALUES ('John Doe', 'johndoe@example.com')
1 row(s) inserted.
Populate the regexp_temp table
INSERT INTO regexp_temp (empName, emailID) VALUES ('Jane Doe', 'janedoe@example.com')
1 row(s) inserted.
Query the table with empName
SELECT empName "ALL_EMPLOYEES" FROM regexp_temp
ALL_EMPLOYEES |
---|
John Doe |
Jane Doe |
Query the table and replace the name string
SELECT empName, REGEXP_REPLACE (empName, 'Jane', 'John') "STRING_REPLACE" FROM regexp_temp
EMPNAME | STRING_REPLACE |
---|---|
John Doe | John Doe |
Jane Doe | John Doe |
Query the table and replace the name string
SELECT empName, REGEXP_REPLACE (empName, 'John', 'Jane') "STRING_REPLACE" FROM regexp_temp
EMPNAME | STRING_REPLACE |
---|---|
John Doe | Jane Doe |
Jane Doe | Jane Doe |
Drop the table
DROP TABLE regexp_temp
Table dropped.