How to delete an unknown object?
-
07-10-2020 - |
Question
I want to create a new stored procedure but I got this error:
00955. 00000 - "name is already used by an existing object"
The problem is I don't remember to have created an object with this name and, now, I would like to remove it (don't worry, it's not on my production database).
How can I find the type of this object in order to drop it correctly?
Solution
The DBA_OBJECTS
view describes all the objects in the database. In it, you can find, by instance, the name of an object, its owner or its type.
Example:
SELECT owner, object_name, object_type FROM dba_objects WHERE object_name = 'MY_OBJECT'; -- Be careful, the name is case sensitive.
OWNER OBJECT_NAME OBJECT_TYPE
------------------- ------------------- -------------------
MY_USER MY_OBJECT PROCEDURE
Now, you can easily drop it:
DROP PROCEDURE MY_OBJECT;
Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange