Link to home
Start Free TrialLog in
Avatar of loginboy
loginboyFlag for United States of America

asked on

PLS-00306: wrong number or types of arguments in call to

Hi Gurus,

I'm trying to resolve this but in vain. I know its simple but not sure what;s wrong. Please advice


Proc when executed without giving the parameter names it works.
But when given i.e calling using => it fails.

Error report:
ORA-06550: line 10, column 3:
PLS-00306: wrong number or types of arguments in call to 'PROC1'
ORA-06550: line 10, column 3:
PL/SQL: Statement ignored

Please advice. Attached is the code.  
create or replace procedure proc1(i_name   IN varchar2,
                                  o_owner  OUT varchar2,
                                  o_type   OUT varchar2,
                                  o_id     OUT varchar2
                                  ) 
as
 v_owner  varchar2(30) := '';
 v_type   varchar2(30) := '';
 v_id  varchar2(30) := '';
begin
 select owner,object_type,data_object_id
  into v_owner,v_type,v_id
  from all_objects
 where UPPER(object_name) = UPPER(i_name);
  o_owner := v_owner;
  o_type  := v_type;
  o_id    := v_id;
end;
/

-- Test Case 1: Call Proc 
declare
 ip_name  varchar2(30) := '';
 v_owner  varchar2(30) := '';
 v_type   varchar2(30) := '';
 v_id     varchar2(30) := '';
begin
  ip_name := 'EMP';
  proc1(ip_name,
        v_owner,
        v_type,
        v_id       
        );
 dbms_output.put_line ('ip_name - '||ip_name);
 dbms_output.put_line ('v_owner - '||v_owner);
 dbms_output.put_line ('v_type - '||v_type);
 dbms_output.put_line ('v_id - '||v_id);
end;
/

-- test Case 2: Call proc FAILS

declare
 ip_name  varchar2(30) := '';
 v_owner  varchar2(30) := '';
 v_type   varchar2(30) := '';
 v_id     varchar2(30) := '';
begin
  ip_name := 'EMP';
  proc1(testname  => ip_name,
        testowner => v_owner,
        testtype  => v_type,
        testid    => v_id       
        );
 dbms_output.put_line ('ip_name - '||ip_name);
 dbms_output.put_line ('v_owner - '||v_owner);
 dbms_output.put_line ('v_type - '||v_type);
 dbms_output.put_line ('v_id - '||v_id);
end;
/

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Sean Stuber
Sean Stuber

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You have to use the parameters name defined on the procedure; try:
declare
 ip_name  varchar2(30) := '';
 v_owner  varchar2(30) := '';
 v_type   varchar2(30) := '';
 v_id     varchar2(30) := '';
begin
  ip_name := 'EMP';
  proc1(i_name  => ip_name,
        o_owner => v_owner,
        o_type  => v_type,
        o_id    => v_id      
        );
 dbms_output.put_line ('ip_name - '||ip_name);
 dbms_output.put_line ('v_owner - '||v_owner);
 dbms_output.put_line ('v_type - '||v_type);
 dbms_output.put_line ('v_id - '||v_id);
end;
/