Calling MS Sql Stored Procedure from jasper studio

0

I tried followed syntax in jasper studio (Note Parameter Class is 'java.lang.String')

SP_Name $P(Parameter)

and also tried

SP_Name $P!(Parameter)

and I have a stored procedure like by following

ALTER PROCEDURE [dbo].[SP_Name ]
    @Parameter VARCHAR(50)
 
    AS
    BEGIN
 
    SELECT * FROM tablename WHERE id IN (@Parameter)
 
    END

while trying the above scenario i got the following error in jasper studio

> procedure have too many arguments

or

> Conversion failed when converting the varchar value '1,2' to data type
> int.

please provide a proper solution for this..
Thanks in advance...

rajasekar_1's picture
Joined: Jul 24 2018 - 4:00am
Last seen: 3 months 2 weeks ago

3 Answers:

1

It looks like you dont have a OUT parameter for Jasper to iterate through as a resultset.

But in order to call the procedure, you need something like this

Call procedure_name ($P{parm1},"$P!{parm2}");

reportdev's picture
1222
Joined: Oct 12 2015 - 12:05pm
Last seen: 3 months 1 week ago
0

Hi the above scenario throw the same error...

rajasekar_1's picture
Joined: Jul 24 2018 - 4:00am
Last seen: 3 months 2 weeks ago
0

As previous poster indicated, the procedure is invoked using "call <stored_proc_name>(<arguments>)". I'd suggest first to try to simplify the query, remove the parameters and see if that runs successfully for you. Then add the parameter. It seems there is an error here in executing the SQL statement, I am not sure what value you pass with the parameter.

Friendly User's picture
Joined: Oct 8 2009 - 5:59am
Last seen: 3 days 10 hours ago
Feedback
randomness