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?
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.
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;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With