我在这个遗留数据库中有一些用户创建的存储过程和函数。如何列出一个特定模式(例如 SCHEMA1)的所有过程和函数。
最佳答案
架构和用户在 Oracle 中有些同义词。
如果您想列出特定模式中的所有过程和函数,则查询:
- user_objects:如果您以要查询对象列表的用户身份登录。
- all_objects:您需要使用OWNER进行过滤。
例如,
SELECT * FROM user_objects WHERE object_type IN('FUNCTION', 'PROCEDURE');
或者,
SELECT * FROM ALL_OBJECTS WHERE OBJECT_TYPE IN ('FUNCTION','PROCEDURE') AND OWNER = 'your_schema_name';
确保以大写形式传递所需的值。
更新
来自此处的文档 http://docs.oracle.com/cd/B19306_01/server.102/b14237/statviews_2025.htm ,
ALL_PROCEDURES
ALL_PROCEDURES lists all functions and procedures, along with associated properties. For example, ALL_PROCEDURES indicates whether or not a function is pipelined, parallel enabled or an aggregate function. If a function is pipelined or an aggregate function, the associated implementation type (if any) is also identified.
因此,您还可以根据文档使用 user_procedures View 。
注意
请注意有关*_procedures
的一些事项。您需要注意该过程是独立的还是包装在包中。我在这里写了一篇基于相同内容的文章Unable to find procedure in DBA_PROCEDURES view
关于sql - 如何获取Oracle 9i特定模式中所有用户创建的存储过程和函数的列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28812128/