title: JDBC | SQL Anywhere Error -188: Not enough values for host variables
body: <p>JDBC or Hibernate is showing strange behavior while calling a stored procedure.</p>
  
  <p><strong>Here is the sample code:</strong> </p>
  
  <pre><code>return session.createSQLQuery("select * from pr_ss_coo_10x('31748','NEWRX',null,'5053')")
      ..
      ....tolist();
  </code></pre>
  
  <p><strong>It is throwing error</strong> </p>
  
  <pre><code>Caused by: org.hibernate.exception.SQLGrammarException: could not execute query
  at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:106)
  at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
  at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109)
  at org.hibernate.loader.Loader.doList(Loader.java:2620)
  at org.hibernate.loader.Loader.doList(Loader.java:2600)
  at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2429)
  at org.hibernate.loader.Loader.list(Loader.java:2424)
  at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:336)
  at org.hibernate.internal.SessionImpl.listCustomQuery(SessionImpl.java:1967)
  at org.hibernate.internal.AbstractSessionImpl.list(AbstractSessionImpl.java:322)
  at org.hibernate.internal.SQLQueryImpl.list(SQLQueryImpl.java:125)
  at com.mps.surescript.repository.impl.SSGetInfoRepoImpl.getBenefitCoordInformation(SSGetInfoRepoImpl.java:79)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:497)
  at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
  at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
  at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)
  ... 76 common frames omitted
  Caused by: com.sybase.jdbc3.jdbc.SybSQLException: SQL Anywhere Error -188: Not enough values for host variables
  at com.sybase.jdbc3.tds.Tds.a(Unknown Source)
  at com.sybase.jdbc3.tds.Tds.nextResult(Unknown Source)
  </code></pre>
  
  <p>However, it is working fine when I fire the same query through SQL Anywhere client. Sybase error code document says </p>
  
  <blockquote>
    <p>"You have not provided enough host variables for either the number of
    bind variables, or the statement, or the number of SELECT list items."</p>
  </blockquote>
  
  <p>I have checked it twice and the result set is correctly mapped with the Pojo. <strong>What can be the possible root cause for this problem</strong>?</p>