How to execute stored procedure parameter in crystal report?

Alone picture Alone · Jan 16, 2014 · Viewed 12.5k times · Source

I am use crystal report - 11 I want execute stored procedure with parameter using add command. I am tried below code-

exec sf02.gen_statement_data('MS0001','1-Nov-2013','15-Nov-2013')

but it fetch error invalid SQL statement. so please give me a solution for that.

Answer

A B picture A B · Jan 16, 2014

To call Stored Procedure from crystal report,

Set data source of report to Stored Procedure (DataBase Expert Wizard). That procedure must met thses requirement

1- You must create a package that defines the REF CURSOR (type of field that will be retrieved).

2- The procedure must have a parameter that is a REF CURSOR type. This is because CR uses this parameter to access and define the result set that the stored procedure returns.

3- The REF CURSOR parameter must be defined as IN OUT (read/write mode).

4- Parameters can only be input (IN) parameters. CR is not designed to work with OUT parameters.

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

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

7- The stored procedure cannot call another stored procedure.