cancel
Showing results for 
Search instead for 
Did you mean: 

Issue in Stored procedure

Former Member
0 Kudos


Hi,

I have created a stored procedure, which was compiled successfully but it is throwing an error message while executing in Toad 11g as given below

ORA-06550: line 2, column 1:

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

ORA-06550: line 2, column 1:

PL/SQL: Statement ignored

Could some one help me to amend this query.

 

CREATE OR REPLACE PACKAGE LMHBATCH.MIS_Package

  AS

Type Test_type IS REF CURSOR;

CURSOR;

END MIS_package;

/

 

CREATE OR REPLACE PROCEDURE LMHBATCH.MIS

(Test_Cursor IN OUT MIS_PACKAGE.TEST_TYPE,

supplier IN OUT Redemption.rdm_c_creation_user%type)

as

BEGIN

OPEN Test_Cursor FOR

SELECT distinct rdm_c_creation_user supplier

   FROM LMHBATCH.redemption r

  where  rdm_c_creation_user NOT IN ('BP','ASK')

and TRIM(rdm_c_creation_user) IN

                          ((SELECT DISTINCT (rfr_v_supplier_id)

                            FROM LMHBATCH.rtr_funct_role)

                          )

                          MINUS

SELECT  * FROM

   (SELECT rdm_c_creation_user supplier

     FROM LMHBATCH.redemption

   WHERE

     rdm_d_creation_date_time >= TRUNC (SYSDATE-1)

     AND rdm_d_creation_date_time < TRUNC (SYSDATE)

       AND TRIM(rdm_c_creation_user) IN

                          ((SELECT DISTINCT (rfr_v_supplier_id)

                            FROM LMHBATCH.rtr_funct_role)

                          )

UNION

   SELECT   rdm_c_creation_user supplier

    FROM LMHBATCH.redemption

   WHERE

     rdm_d_creation_date_time >= TRUNC (SYSDATE-1)

     AND rdm_d_creation_date_time < TRUNC (SYSDATE)

       AND TRIM(rdm_c_creation_user) = 'ARGOSREC'

          );           

  loop

  fetch Test_Cursor into supplier;

  EXIT WHEN Test_Cursor%notfound;

  dbms_output.put_line(supplier);

  end loop;

  close Test_Cursor;

END  MIS;

/

I execute the stored proc like below

 

begin

MIS;

end;

/

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

First of all...

  • In order for Crystal Reports to report off an Oracle stored procedures, all of the following requirements must be satisfied:

    1. When using an ODBC connection to access an Oracle stored procedure, you must create a package that defines the REF CURSOR. This REF CURSOR must be strongly bound to a static pre-defined structure. This package must be created separately and before the creation of the stored procedure.

    2. When using a native connection, it is possible to report off the Oracle stored procedure that was created within a package and also an Oracle stored procedure that references a weakly bound REF CURSOR.

    3. The stored procedure must have a parameter that is a REF CURSOR type. Crystal Reports uses this parameter to access and define the result set that the stored procedure returns.

    4. The REF CURSOR parameter must be defined as IN OUT (read/write mode). After the stored procedure has opened and assigned a query to the REF CURSOR, Crystal Reports will perform a FETCH call for every row from the query’s result. This is why the parameter must be defined as IN OUT.

    5. The parameters can only be defined as IN (input) parameters. Crystal Reports is not designed to work with OUT parameters.

    6. The REF CURSOR variable must be opened and assigned its query within the procedure.

    7. The stored procedure can only return one record set. The structure of this record set must not change based on parameters.

    8. The stored procedure cannot call another stored procedure.

    9. If you are using the CR ODBC driver, verify that the option Procedure Return Results is selected as On in the ODBC Driver Configuration setup under the Advanced tab.

    10. If you are using the native Oracle driver and using hard-coded date selection within the stored procedure, the date selection must use either a string representation format of YYYY-DD-MM (where the date field = 2004-01-01) or the To_Date formula function with the same format specified (where date field = To_Date(2004-01-01’,’YYYY-MM-DD’).

    11. Most importantly, the stored procedure must be able to execute successfully in Oracle’s SQL *Plus utility.

    12. If all of the above requirements have been met, verify that the database driver that you are using works with that version of Oracle outside of Crystal Reports.


  • For more information on using Oracle Stored Procedure with Crystal Reports, see the document: Oracle Stored Procedures and Crystal Reports.

    Note: The document was created for older versions of Crystal Reports, but the information it contains is still valid for Crystal Reports 2008, 2011, and 2013

Let me know if it helps.

Regards,
István

Answers (1)

Answers (1)

DellSC
Active Contributor
0 Kudos

This is much more of an Oracle question than a Crystal question.  You will get a better response if you ask this in Oracle's or Toad's forums.

-Dell