oracle: select information about a function/procedure
I would like to retrieve information about procedures/functions from Oracle database. I know, that I can use ALL_PROCEDURES
and USER_OBJECTS
tables, but they only inform me about names of existing procedures/functions. I would like to get retur开发者_如何转开发n type and argument without parsing any source. Is that possible under Oracle? It's pretty easy under PostgreSQL and can be done under MySQL (argument under 5.5 AFAIK).
It sounds like you want the ALL_ARGUMENTS
view (or USER_ARGUMENTS
or DBA_ARGUMENTS
)
SQL> create or replace function f1( p_in in varchar2,
2 p_in_out in out number )
3 return number
4 is
5 begin
6 return 1;
7 end;
8 /
Function created.
SQL> ed
Wrote file afiedt.buf
1 select argument_name, position, in_out, data_type
2 from all_arguments
3 where object_name = 'F1'
4* and package_name is null
SQL> /
ARGUMENT_N POSITION IN_OUT DATA_TYPE
---------- ---------- --------- ----------
P_IN_OUT 2 IN/OUT NUMBER
P_IN 1 IN VARCHAR2
0 OUT NUMBER
精彩评论