Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle: Get list of functions for user

Tags:

oracle

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

EDIT for question clarification:

When (as USER1) I run

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.

Is that suspicion correct?

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

like image 779
David Oneill Avatar asked Jun 01 '10 14:06

David Oneill


People also ask

How do you see all the UDF defined in the current database?

Lists all user-defined functions (UDFs) for which you have access privileges. This command can be used to list the UDFs for a specified database or schema (or the current database/schema for the session), or across your entire account.

What is the use of Listagg in Oracle?

The LISTAGG function is used to aggregate a set of string values within a group into a single string by appending the string-expression values based on the order that's specified in the 'WITHIN GROUP' clause. As a single-set aggregate function, LISTAGG operates on all rows and returns a single output row.

What is DESC command in Oracle?

The DESCRIBE command enables you to describe objects recursively to the depth level set in the SET DESCRIBE command. You can also display the line number and indentation of the attribute or column name when an object contains multiple object types.

What does Listagg return?

Returns the concatenated input values, separated by the delimiter string.


2 Answers

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

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

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.

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.

like image 60
Dave Costa Avatar answered Oct 03 '22 06:10

Dave Costa


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'.

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

select object_name
from   all_objects
where  object_type = 'FUNCTION';
like image 34
Tony Andrews Avatar answered Oct 03 '22 04:10

Tony Andrews