0
votes

I'm trying to retrieve 2 column data using a simple select query in stored procedure. I'm getting output when running in sql server management studio. But executing same query in mulesoft Anypoint studio, I'm getting error

Procedure or function sample1 has too many arguments specified.

Here is the stored procedure created:

ALTER PROCEDURE [dbo].[sample1] @hidden INT
AS
SELECT geo_name,id_definition
FROM geo
WHERE flag_hidden = @hidden
GO

and here is mule flow implementation screenshots:

Please check image for mule implementation of stored procedure

Here is the error screenshot:

Error of Mule flow

2
Your defining output parameters geo_name and id_definition. They're not output parameters, they're not parameters, they're the result set.TZHX
thank you.. your input helped me.. We have to use select * from table name and in mule for calling procedure, we need to pass only input parameters i.e. ( {call sample1(:UP_RUN_ID)} ), not output parameters (firstname, lastname)..sabarinath
But when have to retreive only first_name, last_name and I dont want to use '*', how can i achieve output?sabarinath
Is there a reason why you can't use select first_name, last_name from table1 in your stored procedure?Ann L.
Im getting output when executing stored procedure directly in sql server, but on executing mule., it is not accepting the parameters I passed. Its only accepting select * . Im not sure the technical reason behind this.sabarinath

2 Answers

0
votes

For selecting more than one column you can use the sample below. Kindly replace with appropriate columns.

select actimgUsername,actimgpass,accountName from vendors with(nolock) where actimgUsername = #[flowVars.userName] and actimgpass = #[flowVars.passWord] and accountname = #[flowVars.accountName]

Thanks!

0
votes

I have used cursors to get output in mule flow

`DECLARE @fName varchar(50), @lName varchar(50)

DECLARE abc CURSOR -- Declare cursor

LOCAL SCROLL STATIC

FOR

Select firstName, lastName FROM myTable

OPEN abc -- open the cursor

FETCH NEXT FROM cursorName

INTO @fName, @lName

PRINT @fName + ' ' + @lName -- print the name

WHILE @@FETCH_STATUS = 0

BEGIN

FETCH NEXT FROM cursorName

INTO @fName, @lName

PRINT @fName + ' ' + @lName -- print the name

END

CLOSE abc -- close the cursor

DEALLOCATE abc -- Deallocate the cursor`