• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » Problem getting return value from MSSQL function

#1 2012-05-24 20:45:50

dbemis
New member
Registered: 2012-05-24
Posts: 4

Problem getting return value from MSSQL function

Tags: [mssql]

I am using a tMSSqlSP component to call a function, pass a value, and get a return value. When I run it I get the error: "java.sql.SQLException: Parameter '2' not registered as output parameter. Call registerOutParameter()." I tried unchecking the Is Function box and adding it as an output parameter but unfortunately I get "java.sql.SQLException: Procedure or function GetBACForDealerCode has too many arguments specified." I ran profiler to see how it was calling and the function option seems to call it correctly.

Any ideas? Thanks!


Uploaded Images

Offline

#2 2012-05-25 03:44:45

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: Problem getting return value from MSSQL function

Hi

Welcome to Talend Community!

You'd better add a column in 'Schema Column' and select 'Out' type for it.

Regards,
Pedro


Only Paranoid Survive.

Offline

#3 2012-05-25 15:27:22

dbemis
New member
Registered: 2012-05-24
Posts: 4

Re: Problem getting return value from MSSQL function

pedro wrote:

Hi

Welcome to Talend Community!

You'd better add a column in 'Schema Column' and select 'Out' type for it.

Regards,
Pedro

If I do that it errors with "java.sql.SQLException: Procedure or function GetBACForDealerCode has too many arguments specified"

Offline

#4 2012-05-28 03:59:12

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: Problem getting return value from MSSQL function

Hi

Please show me the arguments of this procedure or function.
When selecting 'is function', you have to select output column from 'Return result in'.
When not selecting it, you need to add 'OUT' column in 'Parameters'.

Regards,
Pedro


Only Paranoid Survive.

Offline

#5 2012-05-29 22:53:53

dbemis
New member
Registered: 2012-05-24
Posts: 4

Re: Problem getting return value from MSSQL function

Attached is a screenshot - including the SQL behind the function. This example gives the error "java.sql.SQLException: Parameter '2' not registered as output parameter. Call registerOutParameter()."


Uploaded Images

Last edited by dbemis (2012-05-29 22:56:10)

Offline

#6 2012-05-30 04:18:53

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: Problem getting return value from MSSQL function

Hi

After creating this function in my local MSSQL server, I know why you didn't get return value.
Modify the settings of tMSSqlSP as the following images.

Regards,
Pedro


Uploaded Images


Only Paranoid Survive.

Offline

#7 2012-05-30 17:27:28

dbemis
New member
Registered: 2012-05-24
Posts: 4

Re: Problem getting return value from MSSQL function

While that did work it doesn't seem like that should be correct - if I needed to keep passing the DealerCode variable through it would get overwritten in that scenario. Is that the intended behavior?

Thanks!

Offline

#8 2012-05-31 04:45:53

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: Problem getting return value from MSSQL function

Hi

Got you.

The schema should be like this.
BAC
DealerCode

The 'BAC' column should be before the 'DealerCode' column.

Regards,
Pedro


Uploaded Images


Only Paranoid Survive.

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » Problem getting return value from MSSQL function

Board footer

Powered by FluxBB