获取ORACLE编程对象定义 [英] Getting ORACLE programming object definitions
问题描述
比方说,我有一个ORACLE模式,其中包含一个程序包. 该程序包定义了类型,功能,过程等:
Let's say I have an ORACLE schema with contains a package. That package defines types, functions, procedures, etc:
CREATE PACKAGE...
DECLARE
FUNCTION ...
PROCEDURE ...
END;
是否可以执行查询以获取那些单独对象的定义,而无需包装程序包?
Is there a query I can execute to get the definitions of those individual objects, without the wrapping package?
推荐答案
If you need the procedures/functions of the package, you can use user_procedures
:
Create Package package_test As
Procedure dummy( x In Number );
Function dummy2 Return Number;
End package_test;
选择对象名,过程名 来自user_procedures 其中object_name ='PACKAGE_TEST';
Select object_name, procedure_name From user_procedures Where object_name = 'PACKAGE_TEST';
返回
PACKAGE_TEST DUMMY
PACKAGE_TEST DUMMY2
PACKAGE_TEST
要获取参数,请从
If you want the code for your packages/procedures/functions, use user_source
for objects of your user, all_source
for objects your user has grants for, and dba_source
for all objects:
Select *
From user_source
Where name = 'YOUR_TEST'
And type = 'PROCEDURE';
如果您之前创建过过程your_test
:
If you created the procedure your_test
before:
Create Procedure your_test As
Begin
dbms_output.put_line('test');
End your_test;
它返回
YOUR_TEST PROCEDURE 1 Procedure your_test As
YOUR_TEST PROCEDURE 2 Begin
YOUR_TEST PROCEDURE 3 dbms_output.put_line('test');
YOUR_TEST PROCEDURE 4 End your_test;
这篇关于获取ORACLE编程对象定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!