[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2758
  • Last Modified:

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

0
loginboy
Asked:
loginboy
1 Solution
 
sdstuberCommented:
if you use the named parameter method, you must use the correct parameter names


change this...

 proc1(testname  => ip_name,
        testowner => v_owner,
        testtype  => v_type,
        testid    => v_id      
        );


to this ...


 proc1(i_name => ip_name,
        o_owner => v_owner,
        o_type => v_type,
        o_id => v_id      
        );
0
 
cklautauCommented:
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;
/
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now