Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 E-mail Us
 Oracle Articles
New Oracle Articles

 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog

 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Oracle Support

 SQL Tuning

 Oracle UNIX
 Oracle Linux
 Remote s
 Remote plans
 Application Server

 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S


 Consulting Staff
 Consulting Prices
 Help Wanted!


 Oracle Posters
 Oracle Books

 Oracle Scripts

Don Burleson Blog 







Create or Replace Procedure Tips

Oracle Database Tips by Donald Burleson

Oracle CREATE OR REPLACE procedure

A procedure is created using the Oracle create or replace procedure syntax below:

create or replace procedure <Name>
  (<variable list>)
as (or is)

  local variable declaration
    code section

With Oracle CREATE OR REPLACE, the OR REPLACE clause allows the compiler to replace a procedure if a procedure of the same name is already in the database schema.  This aspect of the Oracle CREATE OR REPLACE procedure is handy during development as you do not have to drop the procedure each time before recreating it.

With the Oracle CREATE OR REPLACE procedure the procedure can be called any valid object name.  As with any database object, the Oracle CREATE OR REPLACE procedure is created in the user's schema unless a schema name is provided.  The example below creates the Oracle procedure in the PUBS schema.  The user of the CREATE OR REPLACE procedure must have rights granted to create objects in another schema.

create or replace procedure pubs.example_defaults

Oracle 10g Changes to REPLACE:

In Oracle Database 10g, the REPLACE function has been extended with the regexp_replace function.

regexp_replace extends the functionality of the REPLACE function by letting you search a string for a regular expression pattern. By default, the function returns the supplied source_string variable with every occurrence of the regular expression pattern replaced by the supplied replace_string variable. The string returned is either VARCHAR2 or CLOB, and in the same character set as the source_string supplied.

Let's look at an example of regexp_replace (note: in this example we added a column to the emp table to allow for emp_phone):

   2 REGEXP_REPLACE(emp_phone,
   3 '([[:digit:]]{3})\.([[:digit:]]{3})\.([[:digit:]]{4})',
   4 '(\1) \2-\3') "Test"
   5 FROM emp;

  (404) 444-4321
  (404) 555-5432
  (404) 666-6543

In this eample we search for a pattern of numbers that looks like a European phone number listing such as 111.222.3333 and convert it to a normal USA format listing of (111) 222-3333.



Oracle Training at Sea
oracle dba poster

Follow us on Twitter 
Oracle performance tuning software 
Oracle Linux poster


Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.