Unable to Drop a Procedure. [message #571691] |
Thu, 29 November 2012 03:43  |
 |
stalin4d
Messages: 226 Registered: May 2010 Location: Chennai, Tamil Nadu, Indi...
|
Senior Member |
|
|
Hi,
I tried to Drop a procedure we have created, but an error is raised while droping it.
ora-04043 object does not exist
what is the reason?
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Unable to Drop a Procedure. [message #571713 is a reply to message #571704] |
Thu, 29 November 2012 06:55   |
Solomon Yakobson
Messages: 3305 Registered: January 2010 Location: Connecticut, USA
|
Senior Member |
|
|
stalin4d wrote on Thu, 29 November 2012 06:22procedure name 'Aim_Sp_login_Check' is found in the All Objects area,
yes we have the rights or privileges to do the action.
If you see object in ALL_OBJECTS is means you have at least one privilege on it, not necessarily one you need:
SQL> create procedure p1
2 is
3 begin
4 null;
5 end;
6 /
Procedure created.
SQL> grant execute on scott.p1 to u1
2 /
Grant succeeded.
SQL> connect u1@orcl
Enter password: **
Connected.
SQL> select count(*)
2 from all_objects
3 where owner = 'SCOTT'
4 and object_name = 'P1'
5 and object_type = 'PROCEDURE'
6 /
COUNT(*)
----------
1
SQL> exec scott.p1;
PL/SQL procedure successfully completed.
SQL> drop procedure scott.p1
2 /
drop procedure scott.p1
*
ERROR at line 1:
ORA-01031: insufficient privileges
SQL>
You need to check USER_SYS_PRIVS and USER_ROLE_PRIVS and make sure user has DROP ANY PROCEDURE privilege.
SY.
|
|
|
|
|
|
Re: Unable to Drop a Procedure. [message #571751 is a reply to message #571750] |
Thu, 29 November 2012 22:44   |
 |
BlackSwan
Messages: 26766 Registered: January 2009 Location: SoCal
|
Senior Member |
|
|
oracle is too dumb to lie regarding any error
04043, 00000, "object %s does not exist"
// *Cause: An object name was specified that was not recognized by the system.
// There are several possible causes:
// - An invalid name for a table, view, sequence, procedure, function,
// package, or package body was entered. Since the system could not
// recognize the invalid name, it responded with the message that the
// named object does not exist.
// - An attempt was made to rename an index or a cluster, or some
// other object that cannot be renamed.
// *Action: Check the spelling of the named object and rerun the code. (Valid
// names of tables, views, functions, etc. can be listed by querying
// the data dictionary.)
|
|
|
|
|
Re: Unable to Drop a Procedure. [message #571791 is a reply to message #571750] |
Fri, 30 November 2012 08:57   |
Solomon Yakobson
Messages: 3305 Registered: January 2010 Location: Connecticut, USA
|
Senior Member |
|
|
stalin4d wrote on Thu, 29 November 2012 23:38I dont get msg like insufficient privileges
Login as same user you were logged in when dropping procedure. Issue:
SELECT owner
object_name,
object_type
FROM all_objects
WHERE upper(object_name) = upper('AIM_SP_Login_Check')
/
and post results.
SY.
|
|
|
|
Re: Unable to Drop a Procedure. [message #571807 is a reply to message #571796] |
Fri, 30 November 2012 11:58   |
cookiemonster
Messages: 13967 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
On closer inspection of the original image the problem is nothing to do with privileges. It's to do with case.
The procedure name is displayed in mixed case. So it was created in mixed case by wrapping the name in double quotes.
It has to be dropped the same way:
drop procedure "AIM_SP_Login_Check";
Next time don't create objects with mixed case names
|
|
|
|
Re: Unable to Drop a Procedure. [message #572428 is a reply to message #571807] |
Wed, 12 December 2012 01:16   |
 |
stalin4d
Messages: 226 Registered: May 2010 Location: Chennai, Tamil Nadu, Indi...
|
Senior Member |
|
|
Mixed case means Upper and lower case in creating an object are you saying this?
but i dont think so this is not the problem.
littlefoot its not similar like Toad, We use Plsql Developer which does'nt have filter
like toad.
[Updated on: Wed, 12 December 2012 01:20] Report message to a moderator
|
|
|
Re: Unable to Drop a Procedure. [message #572462 is a reply to message #572428] |
Wed, 12 December 2012 04:15   |
cookiemonster
Messages: 13967 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
stalin4d wrote on Wed, 12 December 2012 07:16Mixed case means Upper and lower case in creating an object are you saying this?
Yes
stalin4d wrote on Wed, 12 December 2012 07:16
but i dont think so this is not the problem.
I guarantee it is the problem. Look:
SQL> create table test (a number);
Table created.
SQL> create table "test" (a number);
Table created.
SQL> create table "Test" (a number);
Table created.
SQL> select table_name from user_tables where upper(table_name) = 'TEST';
TABLE_NAME
--------------------------------------------------------------------------------
TEST
Test
test
SQL> --the one in upper case is the original, oracle automatically stores object names in upper case
SQL> --unless you wrap the object name in double quotes
SQL>
SQL> drop table test;
Table dropped.
SQL> select table_name from user_tables where upper(table_name) = 'TEST';
TABLE_NAME
--------------------------------------------------------------------------------
Test
test
SQL> drop table Test;
drop table Test
*
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> --doesn't work because oracle uppers the table name which then doesn't match the existing tables.
SQL> --need to wrap in in double quotes
SQL> drop table "Test";
Table dropped.
SQL> select table_name from user_tables where upper(table_name) = 'TEST';
TABLE_NAME
--------------------------------------------------------------------------------
test
SQL> drop table "test";
Table dropped.
SQL>
Any object that appears in the object lists in mixed case (like your procedure) was created by wrapping the object name in double quotes. In order to be anything with that object you have to wrap the name in double quotes and get the case of all the letters the same every time you want to reference it.
stalin4d wrote on Wed, 12 December 2012 07:16
littlefoot its not similar like Toad, We use Plsql Developer which does'nt have filter
like toad.
Yes it does, I told you so, I use PL/SQL developer so I would know. The filter is irrelevant to this problem though.
|
|
|
Re: Unable to Drop a Procedure. [message #572466 is a reply to message #572462] |
Wed, 12 December 2012 04:35   |
mvmkandan
Messages: 68 Registered: May 2010 Location: Trivendrum
|
Member |
|
|
Stalin,
try with this statement by passing your procedure name.. check it will return any records or not.
select * from user_procedures where procedure_name = :proc_name
Veera
|
|
|
Re: Unable to Drop a Procedure. [message #572492 is a reply to message #572466] |
Wed, 12 December 2012 07:51   |
joy_division
Messages: 4963 Registered: February 2005 Location: East Coast USA
|
Senior Member |
|
|
mvmkandan wrote on Wed, 12 December 2012 05:35Stalin,
try with this statement by passing your procedure name.. check it will return any records or not.
select * from user_procedures where procedure_name = :proc_name
This is incorrect. Plus cookiemonster gave the proper advice already.
|
|
|
|
|
Re: Unable to Drop a Procedure. [message #572559 is a reply to message #572532] |
Thu, 13 December 2012 04:07  |
cookiemonster
Messages: 13967 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Well not exactly.
The procedure name in user_procedures (and user_objects) for the problem procedure will be in mixed case. That's what PL/SQL is displaying in the original screenshot.
Oracle uppers any object name in code before storing it in, or comparing it to, the data dictionary, unless the object name is wrapped in double quotes. In which case oracle leaves it as it is.
|
|
|