Oracle:获取用户的功能列表

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2950490/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 20:43:58  来源:igfitidea点击:

Oracle: Get list of functions for user

oracle

提问by David Oneill

How do I get a list of all the functions for a particular user?

如何获取特定用户的所有功能列表?

EDIT for question clarification:

编辑问题澄清:

When (as USER1) I run

当(作为 USER1)我运行

select * from all_objects
where owner = 'USER2'
and object_type = 'FUNCTION';

it doesn't return all the functions that I know USER2 owns. I suspect that it is only returning those functions that USER1 is allowed to view/execute.

它不会返回我知道 USER2 拥有的所有功能。我怀疑它只返回那些允许 USER1 查看/执行的函数。

Is that suspicion correct?

这种怀疑是否正确?

Also, if that is true, is there a way to get around this?

另外,如果这是真的,有没有办法解决这个问题?

采纳答案by Dave Costa

Yes, your suspicion is correct. The ALL_OBJECTS view will only list those items that the current user has access to.

是的,你的怀疑是正确的。ALL_OBJECTS 视图将只列出当前用户有权访问的那些项目。

If you can log in as USER2, then you can query USER_OBJECTS as that user to see all objects owned by that user.

如果您可以作为 USER2 登录,那么您可以作为该用户查询 USER_OBJECTS 以查看该用户拥有的所有对象。

If you can log in as SYSTEM, then you would have access to all objects regardless of owner, so the list provided by ALL_OBJECTS (or DBA_OBJECTS) would be complete.

如果您可以以 SYSTEM 身份登录,那么无论所有者如何,您都可以访问所有对象,因此 ALL_OBJECTS(或 DBA_OBJECTS)提供的列表将是完整的。

If you can't log in as a user that has access to all of USER2's objects, then you can't list all of USER2's objects.

如果您无法以有权访问 USER2 的所有对象的用户身份登录,则您无法列出 USER2 的所有对象。

回答by Tony Andrews

If you mean a list of functions the belong to a particular user then:

如果您的意思是属于特定用户的功能列表,则:

select object_name
from   all_objects
where  owner = 'WHOEVER'
and    object_type = 'FUNCTION';

This will return only stand-alone functions, not procedures or function in packages, that belong to the schema 'WHOEVER'.

这将仅返回属于架构“WHOEVER”的独立函数,而不是包中的过程或函数。

To obtain a list of allfunctions that the current user can access:

获取当前用户可以访问的所有功能的列表:

select object_name
from   all_objects
where  object_type = 'FUNCTION';

回答by ashutosh5111

select * from dba_objects where owner = 'USER2' and object_type = 'FUNCTION';

select * from dba_objects where owner = 'USER2' and object_type = 'FUNCTION';