Passing multiple parameters to sql server stored procedure from jaspersoft studio 5.6


        I have a stored procedure my_sp which takes in two parameters, first an integer and then a date. That is,

EXEC my_sp 265522,'6-10-15'

I have been trying to design a report based on the result set from this procedure in Jaspersoft Studio 5.6. The report does not generate or atleast takes way too long if I use the two parameters though the output data consists of only 25 rows. I am using this query,

exec my_sp $P{param1} , $P{param2} 
and feel the probelm is with the syntax only. Also the same query works perfect when I had tried it in Sql Server Management Studio and in jaspersoft studio, stored procedures with a single parameter work like magic.  Kindly help me out on this
vhp1990's picture
Joined: Apr 8 2014 - 10:00pm
Last seen: 7 years 12 months ago

Hi vhp1990,

Your syntax for runningSP with multiple parameter is correct. But the issue can be at the format of teh parameter field created.

Can you confirm you have created param1 as Integer and Param2 as DateTime?


Rajesh S

rajesh.sirsikar - 8 years 3 months ago

Hello Rajesh. Yes the problem was with the parameter. Since I was trying to format the parameter before passing it, it was throwing up an error. Thanks a lot.

vhp1990 - 8 years 3 months ago

1 Answer:

Hi everyone!

You can call the procedure when you adding a dataset with  PL/SQL text code.

{ CALL schema.NAME_SP($P{param1} , $P{param2} ,$P{ORACLE_REF_CURSOR}) } 

the param Oracle_ref_cursor contains the params of your response call, and you must create the fields. the field name must be the same procedure to set your params return like that:

<queryString language="plsql">
schema.NAME_SP($P{param1} , $P{param2} ,$P{ORACLE_REF_CURSOR})]]>
        <field name="response1" class="java.lang.String"/>
        <field name="response2" class="java.lang.String"/>

Now, you can use any ORACLE procedures.

davidiazcasta's picture
Joined: Mar 18 2015 - 3:18am
Last seen: 7 years 5 months ago