Reputation: 93
I have tried simple stored procedure in oracle 11g through sql developer as:
CREATE PROCEDURE P1 AS
BEGIN
DBMS.OUTPUT.PUT.LINE('WELCOME TO ORACLE');
END P1;
but still I am getting following error: ORA-00955: name is already used by an existing object
I am not getting exactly how to solve this error. Can anyone please help me..?
Upvotes: 1
Views: 459
Reputation: 79033
There are two problems:
First of all, you've probably already save the stored procedure once. So you cannot create it anymore but have to replace it. Second, the procedure name for writing output is misspelled.
So try this code:
CREATE OR REPLACE PROCEDURE P1 AS
BEGIN
DBMS_OUTPUT.PUT_LINE('WELCOME TO ORACLE');
END P1;
/
Upvotes: 1
Reputation: 172628
The error says it all. You already have a stored procedure named as P1, so either drop the existing one or give this procedure a different name. To check if the procedure already exists use this query:
SELECT *
FROM USER_PROCEDURES
WHERE object_name = 'P1'
or
SELECT *
FROM USER_OBJECTS
WHERE object_type = 'PROCEDURE'
AND object_name = 'P1'
Upvotes: 1