Home » SQL & PL/SQL » SQL & PL/SQL » PLS-00306: wrong number or types of arguments in call
PLS-00306: wrong number or types of arguments in call [message #245477] Sun, 17 June 2007 17:11 Go to next message
jamalfarooq
Messages: 35
Registered: August 2006
Member
-------- package spec.

CREATE OR REPLACE PACKAGE EMP_DATA AS
TYPE EMPCURTYPE IS REF CURSOR RETURN EMPLOYEES%ROWTYPE;
PROCEDURE OPEN_EMP_CV (EMP_CV IN OUT EMPCURTYPE);
END EMP_dATA;
/

-------- package body

1 CREATE OR REPLACE PACKAGE BODY EMP_DATA AS
2 PROCEDURE OPEN_EMP_CV (EMP_CV IN OUT EMPCURTYPE) IS
3 V_EMP_REC EMPLOYEES%ROWTYPE;
4 BEGIN
5 OPEN EMP_CV FOR SELECT * FROM EMPLOYEES WHERE ROWNUM < 11;
6 LOOP
7 FETCH EMP_CV INTO V_EMP_REC;
8 DBMS_OUTPUT.PUT_LINE(V_EMP_REC.LAST_NAME);
9 END LOOP;
10 END OPEN_EMP_CV;
11* END;
12 /

----------- 1st try
1 DECLARE
2 V_EMP_REC EMPLOYEES%ROWTYPE;
3 BEGIN
4 EMP_DATA.OPEN_EMP_CV(V_EMP_REC);
5* END;
SQL> /
EMP_DATA.OPEN_EMP_CV(V_EMP_REC);
*
ERROR at line 4:
ORA-06550: line 4, column 1:
PLS-00306: wrong number or types of arguments in call to 'OPEN_EMP_CV'
ORA-06550: line 4, column 1:
PL/SQL: Statement ignored

--------- 2nd try
1 DECLARE
2 TYPE V_EMP_REC is table of EMPLOYEES%ROWTYPE;
3 EMP_REC V_EMP_REC;
4 BEGIN
5 EMP_DATA.OPEN_EMP_CV(EMP_REC);
6* END;
SQL> /
EMP_DATA.OPEN_EMP_CV(EMP_REC);
*
ERROR at line 5:
ORA-06550: line 5, column 1:
PLS-00306: wrong number or types of arguments in call to 'OPEN_EMP_CV'
ORA-06550: line 5, column 1:
PL/SQL: Statement ignored

--------- 3rd try

1 DECLARE
2 TYPE V_EMP_REC IS REF CURSOR RETURN EMPLOYEES%ROWTYPE;
3 EMP_REC V_EMP_REC;
4 BEGIN
5 EMP_DATA.OPEN_EMP_CV(EMP_REC);
6* END;
7 /
EMP_DATA.OPEN_EMP_CV(EMP_REC);
*
ERROR at line 5:
ORA-06550: line 5, column 1:
PLS-00306: wrong number or types of arguments in call to 'OPEN_EMP_CV'
ORA-06550: line 5, column 1:
PL/SQL: Statement ignored


can't find solution how i can call my package procedure. !!!!
Please reply or do email to jfarooq78@hotmail.com

thanks.
Re: PLS-00306: wrong number or types of arguments in call [message #245478 is a reply to message #245477] Sun, 17 June 2007 17:36 Go to previous messageGo to next message
BlackSwan
Messages: 25036
Registered: January 2009
Location: SoCal
Senior Member
>can't find solution how i can call my package procedure. !!!!
Please read & FOLLOW the posting guidelines as enumerated in the #1 STICKY post at top of this forum.

Here is a free clue a REFCURSOR is a different data type than a record.

[Updated on: Sun, 17 June 2007 17:38] by Moderator

Report message to a moderator

Re: PLS-00306: wrong number or types of arguments in call [message #245480 is a reply to message #245478] Sun, 17 June 2007 17:48 Go to previous messageGo to next message
jamalfarooq
Messages: 35
Registered: August 2006
Member
Thanks for your reply and i'll take care for next time.

As i posted all my efforts to resolve this but still i am not getting solution can you please post right block to call this package ?

Thanks.
Jamal
Re: PLS-00306: wrong number or types of arguments in call [message #245482 is a reply to message #245477] Sun, 17 June 2007 18:01 Go to previous messageGo to next message
BlackSwan
Messages: 25036
Registered: January 2009
Location: SoCal
Senior Member
>TYPE EMPCURTYPE IS REF CURSOR
.
>2 V_EMP_REC EMPLOYEES%ROWTYPE;
REF CURSOR is NOT ROWTYPE
What part of the line immediately above do you not understand?
icon10.gif  Re: PLS-00306: wrong number or types of arguments in call [message #245485 is a reply to message #245482] Sun, 17 June 2007 18:19 Go to previous message
jamalfarooq
Messages: 35
Registered: August 2006
Member
thank now it's working i was wrong....
thanks once again.

Cool

SQL> ed
Wrote file afiedt.buf

1 CREATE OR REPLACE PACKAGE BODY EMP_DATA AS
2 PROCEDURE OPEN_EMP_CV (EMP_CV IN OUT EMPCURTYPE) IS
3 V_EMP_REC EMPLOYEES%ROWTYPE;
4 BEGIN
5 -- OPEN EMP_CV FOR SELECT * FROM EMPLOYEES WHERE ROWNUM < 11;
6 LOOP
7 FETCH EMP_CV INTO V_EMP_REC;
8 exit when emp_cv%notfound;
9 DBMS_OUTPUT.PUT_LINE(V_EMP_REC.LAST_NAME);
10 END LOOP;
11 END OPEN_EMP_CV;
12* END;
13 /

Package body created.

SQL> declare
2 type ref_cur is ref cursor;
3 v_ref_cur ref_cur;
4 begin
5 open v_ref_cur for select * from employees where rownum < 11;
6 emp_data.open_emp_cv(v_ref_cur);
7 end;
8 /
King
Kochhar
De Haan
Hunold
Ernst
farooq
Pataballa
Lorentz
Greenberg
Faviet

PL/SQL procedure successfully completed.
Previous Topic: index in oracle
Next Topic: which table are updated
Goto Forum:
  


Current Time: Sun Dec 04 06:20:47 CST 2016

Total time taken to generate the page: 0.05339 seconds