0

Where does it go wrong, please?

spec:

CREATE OR REPLACE PACKAGE CTI_MATRIX.AMD AS
  TYPE REF_CURSOR IS REF CURSOR;
  PROCEDURE AMD_NEEDMSG (v_CRN IN VARCHAR2, return_recordset OUT REF_CURSOR);
END AMD;

body:

CREATE OR REPLACE PACKAGE BODY CTI_MATRIX.AMD AS
PROCEDURE AMD_NEEDMSG (v_CRN IN VARCHAR2, return_recordset OUT REF_CURSOR)
IS
BEGIN
    -- 
END AMD_NEEDMSG;
END AMD;

Failing block from TOAD:

DECLARE 
RETURN_RECORDSET AMD.REF_CURSOR;
BEGIN 
    RETURN_RECORDSET := NULL;
    CTI_MATRIX.AMD.AMD_NEEDMSG ( '123456789', RETURN_RECORDSET );
END;

Error: PLS-00382 Expression is of wrong type line 5

2

2 Answers 2

0

who are you logged on as?

as:

DECLARE 
RETURN_RECORDSET AMD.REF_CURSOR;
BEGIN 
    RETURN_RECORDSET := NULL;
    CTI_MATRIX.AMD.AMD_NEEDMSG ( '123456789', RETURN_RECORDSET );
END;

is correct syntax, but i see you are prefixing the owner on the package call (CTI_MATRIX) but NOT on the declaration of RETURN_RECORDSET AMD.REF_CURSOR;. if you're calling this as another user that also has a copy of the package AMD then you'd get this error message.

Also no need to assign NULL to the recordset on line 4.

2
  • Tried with: DECLARE RETURN_RECORDSET CTI_MATRIX.AMD.REF_CURSOR; BEGIN CTI_MATRIX.AMD.AMD_NEEDMSG ( '123456789', RETURN_RECORDSET ); END; but still getting: ORA-20001: An error was encountered ORA-00937: not a single-group group function ORA-06512: at "CTI_MATRIX.AMD", line 69 ORA-06512: at line 4 Then after adding ':' to RETURN_RECORDSET in CTI_MATRIX.AMD.AMD_NEEDMSG ( '123456789', :RETURN_RECORDSET ); produced error message: ORA-06550: line 4, column 3: PLS-00306: wrong number or types of arguments in call to 'AMD_NEEDMSG' ORA-06550: line 4, column 3: PL/SQL: Statement ignored Jan 13, 2013 at 12:44
  • @user1970875 ORA-06512: at "CTI_MATRIX.AMD", line 69 = a code fault in your API itself on line 69 so you need to fix that before anything else. and why did you put a colon on :RETURN_RECORDSET ? this is only used for bind variables, not plsql variables.
    – DazzaL
    Jan 13, 2013 at 13:13
0

In the procedure the second parameter is of type "REF_CURSOR", while in the testing pl/sql block it is "AMD.REF_CURSOR". Check if the two types are the same, i guess they aren't. Or change the testing pl/sql block so that you define the variable like this:

RETURN_RECORDSET CTI_MATRIX.AMD.REF_CURSOR;
2
  • Tried with: DECLARE RETURN_RECORDSET CTI_MATRIX.AMD.REF_CURSOR; BEGIN CTI_MATRIX.AMD.AMD_NEEDMSG ( '123456789', RETURN_RECORDSET ); END; but still getting: ORA-20001: An error was encountered ORA-00937: not a single-group group function ORA-06512: at "CTI_MATRIX.AMD", line 69 ORA-06512: at line 4 Then after adding ':' to RETURN_RECORDSET in CTI_MATRIX.AMD.AMD_NEEDMSG ( '123456789', :RETURN_RECORDSET ); produced error message: ORA-06550: line 4, column 3: PLS-00306: wrong number or types of arguments in call to 'AMD_NEEDMSG' ORA-06550: line 4, column 3: PL/SQL: Statement ignored Jan 13, 2013 at 12:49
  • First fix the error in the package CTI_MATRIX.AMD, line 69. Something is wrong with the select statement at that line, it has to do with group by. Then try to execute your block again.
    – Alen Oblak
    Jan 14, 2013 at 8:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.