OR REPLACE Clause

The OR REPLACE clause is used to update an existing function without changing any object privileges granted on it.

Example

create function testfunc() returning char(50);
    return "this is the original function";
end function;
Routine created.
 
execute function testfunc();
 
(expression)                                       
 
this is the original function                     
 
1 row(s) retrieved.
 
create function testfunc() returning char(50);
    return "this is the replaced function";
end function;

  673: Another routine (testfunc) with same signature already exists in database

 
create or replace function testfunc() returning char(50);
    return "this is the replaced function";
end function;
Routine created.
 
execute function testfunc();
 
(expression)                                       
 
this is the replaced function                     
 
1 row(s) retrieved.