开发者

Can someone explain same function's different behaviour under differnt user in oracle?

I have a package called A and A has function doSomething();

user x is the owner of A. user y has a synonym testSyn which points to x.A;

Logged in as x and executed function doSomething() is returning true but When logged in as user y and executed the function like testSyn.doSomething(), it returns false for the s开发者_如何学Goame value.

Could someone please explain why this happens?


Take a look at the procedure's definition. If it's something like PROCEDURE a AUTHID CURRENT_USER then it will execute with the current user's permissions and name resolution. If the procedure uses views that take user privileges into account (such as user_objects), that could explain the different result.


Comment response: You're making the wrong distinction. Imagine that you write a procedure that returns the object_name of the first row from user_objects. That procedure is owned by schema_owner and schema_invoker has permission to execute it. If the procedure is defined without AUTHID CURRENT_USER, it will return an object name for an object in the schema_owner schema. The same procedure with AUTHID CURRENT_USER will return an object name from the schema_invoker schema instead. This has nothing to do with execution privileges.

I don't know that this is the source of your problem, but it's a good candidate and it's easy to check (just look at the procedure definition found in the package specification).


You're able to execute that function but you might not have access rights to all the objects the function references. For starters, I'd try to figure out which DB objects your function accesses and try to access those from a tool like sqlplus to verify

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜