# executeStoredProcedure() does not work

**URL:** <https://forum.servoy.com/t/executestoredprocedure-does-not-work/16264>\
**Category:** Classic Servoy\
**Created:** [July 26, 2012, 7:04pm UTC](https://forum.servoy.com/t/executestoredprocedure-does-not-work/16264 "2012-07-26T19:04:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![hardina09](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@hardina09](https://forum.servoy.com/u/hardina09)\
**Post date:** [July 26, 2012, 7:04pm UTC](https://forum.servoy.com/t/executestoredprocedure-does-not-work/16264/1 "2012-07-26T19:04:47Z")

</div>

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

```auto
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

---

<div class="post-metadata">

**Author:** ![Peter\_de\_Groot](https://avatars.discourse-cdn.com/v4/letter/p/b4bc9f/32.png) [@Peter\_de\_Groot](https://forum.servoy.com/u/Peter_de_Groot)\
**Post date:** [July 26, 2012, 9:02pm UTC](https://forum.servoy.com/t/executestoredprocedure-does-not-work/16264/2 "2012-07-26T21:02:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hardina09](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@hardina09](https://forum.servoy.com/u/hardina09)\
**Post date:** [July 26, 2012, 9:06pm UTC](https://forum.servoy.com/t/executestoredprocedure-does-not-work/16264/3 "2012-07-26T21:06:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![omar](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@omar](https://forum.servoy.com/u/omar)\
**Post date:** [July 27, 2012, 5:11am UTC](https://forum.servoy.com/t/executestoredprocedure-does-not-work/16264/4 "2012-07-27T05:11:10Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![hardina09](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@hardina09](https://forum.servoy.com/u/hardina09)\
**Post date:** [July 27, 2012, 4:58pm UTC](https://forum.servoy.com/t/executestoredprocedure-does-not-work/16264/5 "2012-07-27T16:58:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![omar](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@omar](https://forum.servoy.com/u/omar)\
**Post date:** [July 27, 2012, 9:53pm UTC](https://forum.servoy.com/t/executestoredprocedure-does-not-work/16264/6 "2012-07-27T21:53:52Z")

</div>

Ok, great!
