executeStoredProcedure() does not work

I am using utils.rawSQL to call stored procedure which takes two parameters. one is type integer and other is datetime and returns two values, one is type integer and other is decimal. I know somewhere I am wrong but where I don’t know. Any idea where I went wrong for below code

var typearg=[1,1,0,0]
var args=new Array()
args[0]=java.sql.type.INTEGER;
args[1]=java.sql.type.DECIMAL
args[2]=<somevalue>
args[3]=<somevalue>
var Proce_declaration="{?=call usr_GetTotalTime(?,?)}"
var sernm='Sever_name'
var maxrow=1;
var dataset=plugins.rawSQL.executeStoredProcedure(servnm,Proce_declaration,args,typearg,maxrow)

When I execute dataset.getException() gives message
DS Exception :com.servoy.j2db.persistence.RepositoryException: com.microsoft.sqlserver.jdbc.SQLServerException: The JDBC data type 1,036 is unknown. The JDBC data type 1,036 is unknown.

Any idea where I need to get corrected

Hi,

I see a typo,

var sernm=‘Sever_name’
var maxrow=1;
var dataset=plugins.rawSQL.executeStoredProcedure(servnm,Proce_declaration,args,typearg,maxrow)

have a look at the var sernm, in the procedure call you use servnm

Regards,

Peter

I corrected that. it gives me this error message - DS Exception :com.servoy.j2db.persistence.RepositoryException: java.lang.ClassCastException: org.mozilla.javascript.NativeJavaPackage cannot be cast to java.lang.Number org.mozilla.javascript.NativeJavaPackage cannot be cast to java.lang.Number.

Hi Hardina,

Try calling the procedure with straightforward values instead of variables. Then replace the values by parameters one at a time until you find out which parameter is containing a value that is incompatible with the specified type. Then debug it and compare the values and types. That should narrow it down.

Kind regards,

Thanks Omar N Peter de Groot,

I am able solve above mentioned only by changing var Proce_declaration=“{?=call usr_GetTotalTime(?,?)}” to
var Proce_declaration=“{call usr_GetTotalTime(?,?)}”

Thats it.

Ok, great!