?
Solved

ORA-00955

Posted on 2012-08-14
4
Medium Priority
?
644 Views
Last Modified: 2012-08-14
I have the following error when I run the sql script

CREATE  SYNONYM abc FOR ABC
                *
ERROR at line 1:
ORA-00955: name is already used by an existing object

In my .sql file
I have the following lines

CREATE  SYNONYM abc FOR ABC;
....
exit;


I think the error is because abc already existed

I want to know how I put a condition to say]

if object abc existed already, need to run

CREATE  SYNONYM abc FOR ABC;

the following statement is correct?

IF NOT EXISTS (abc)
CREATE  SYNONYM abc FOR ABC;
0
Comment
Question by:wasabi3689
  • 2
  • 2
4 Comments
 
LVL 78

Accepted Solution

by:
slightwv (䄆 Netminder) earned 600 total points
ID: 38294423
The 'object' that exists is the table.  You cannot create a synonym with the same name as the table in the same schema.  If you think about it, does it make sense to do this?

Once you resolve that issue and if the synonym already exists, use 'or replace':
CREATE or replace  SYNONYM my_syn_for_abc FOR ABC;
0
 
LVL 23

Assisted Solution

by:OP_Zaharin
OP_Zaharin earned 600 total points
ID: 38294425
- the error is because that object name is already exists. and you cant use same synonym as the table in the same schema.

- if you want to replace that synonym you can use the following syntax:

CREATE OR REPLACE SYNONYM abcd FOR ABC;
0
 
LVL 23

Expert Comment

by:OP_Zaharin
ID: 38294434
- duplicate answer from me. earlier expert have already covers it.
0
 
LVL 78

Expert Comment

by:slightwv (䄆 Netminder)
ID: 38294441
No problem OP, it happens to ALL of us....
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
Via a live example, show how to take different types of Oracle backups using RMAN.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question