oracle - Can I execute a procedure with default null parameters? -
i created procedure defined this:
create or replace package pkg_dml_legal_transactions procedure spm_update_court_cost( p_court_state in legal_court_cost.state%type, p_tran_code in legal_court_cost.transaction_code%type, p_legal_court in legal_court_cost.court%type default null, p_end_date in legal_court_cost.end_date%type, p_cost_min in legal_court_cost.cost_range_min%type, p_cost_max in legal_court_cost.cost_range_max%type, p_bal_min in legal_court_cost.bal_range_min%type default null, p_bal_max in legal_court_cost.bal_range_max%type default null); end pkg_dml_legal_transactions;
when attempt execute
procedure, error stating that:
pls-00306: wrong number or types of arguments in call 'spm_update_court_cost'
here execute statement looks like:
execute pkg_dml_legal_transactions.spm_update_court_cost('nj',1,sysdate,1000,40000);
now understand error means, figured if parameters defaulted null skip them over, apparently not. there way around this?
in pl/sql, can call procedure using either named parameter notation or positional notation. if want skip parameters, you'll need use named parameter notation
execute pkg_dml_legal_transactions.spm_update_court_cost( p_court_state => 'nj', p_tran_code => 1, p_end_date => sysdate, p_cost_min => 1000, p_cost_max => 40000 );
generally, when you're designing procedure, put optional parameters @ end caller use positional notation.
Comments
Post a Comment