DBA Tips Archive for Oracle

  


Search and Replace with REPLACE Function

by Jeff Hunter, Sr. Database Administrator


Contents

  1. Overview
  2. Example



Overview

This article provides a simple example of how to search for and replace string content using the build-in REPLACE function in Oracle.



Example

In the following example, I want to replace all occurances of "http://secure." with "https://secure." within the table company_config:
UPDATE company_config
  SET company_url = REPLACE(company_url, 'http://secure.', 'https://secure.')
  WHERE company_url like 'http://secure.%';

1082 rows updated.


Copyright (c) 1998-2014 Jeffrey M. Hunter. All rights reserved.

All articles, scripts and material located at the Internet address of http://www.idevelopment.info is the copyright of Jeffrey M. Hunter and is protected under copyright laws of the United States. This document may not be hosted on any other site without my express, prior, written permission. Application to host any of the material elsewhere can be made by contacting me at jhunter@idevelopment.info.

I have made every effort and taken great care in making sure that the material included on my web site is technically accurate, but I disclaim any and all responsibility for any loss, damage or destruction of data or any other property which may arise from relying on it. I will in no case be liable for any monetary damages arising from such loss, damage or destruction.

Last modified on
Tuesday, 18-Jan-2005 00:00:00 EST
Page Count: 11358