ORA-00955: name is already used by an existing object

ORA-00955: name is already used by an existing object

Oracle PL/SQL error message: ORA-00955: name is already used by an existing object.

Cause:

An attempt was made to create a database object (such as a table, view, cluster, index, or synonym) that already exists.

Solution:

Enter a unique name for the database object or modify or drop the existing object so it can be reused.

Example:

create function get_name (p_id number)
return varchar2 as
  v_error varchar2(4000);
  v_name varchar2(250);
begin
 select name into v_name from employees where id = p_id;
 return v_name;
exception when others then
  v_error := sqlerrm;
  return v_error;
end;

Output:

ORA-00955: name is already used by an existing object

Correct:

create or replace function get_name (p_id number)
return varchar2 as
  v_error varchar2(4000);
  v_name varchar2(250);
begin
 select name into v_name from employees where id = p_id;
 return v_name;
exception when others then
  v_error := sqlerrm;
  return v_error;
end;

Output:

FUNCTION GET_NAME compiled