Get a parameter's name

2019-05-03 07:33发布

I want to get a parameter's name in plsql.

For example,

procedure sp_example(myParam in varchar2) is

paramName varchar2(30);
begin
    paramName = 'myParam';
end
end procedure sp_example;

Is there a way to get the name of myParam using reflection, instead of hard coding it?

2条回答
\"骚年 ilove
2楼-- · 2019-05-03 07:51

Try:

select argument_name from all_arguments where object_name = 'SP_EXAMPLE';

This view can also show you the data types, positions, etc., and you can use it in SQL or PL/SQL. Plenty of info in the various metadata views.

查看更多
来,给爷笑一个
3楼-- · 2019-05-03 08:17

If you want to get the names of parameters retrieved in their respective positions, use

select argument_name from user_arguments where object_name='SAMPLE_PROC' order by position;

查看更多
登录 后发表回答