org.postgresql.util.PSQLException:列索引超出范围:3,456,列数:24

时间:2015-01-16 09:44:27

标签: java postgresql jdbc

我试图在可调用语句的帮助下调用postgresql函数 但我得到例外。

我的Postgresql功能是

CREATE OR REPLACE FUNCTION ins_table_1(_offid character varying, _hh character varying, _register date, _nameof character varying, _addres character varying, _cast character varying, _rel character varying, _typeof character varying, _nameofin character varying, _countr character varying, _count character varying, _stat character varying, _state character varying, _dist character varying, _distn character varying, _vill integer, _villa character varying, _villag character varying, _ward integer, _hous integer, _invest integer, _create date, _modified date, _flag character)
  RETURNS void AS
$BODY$
      BEGIN
      if _flag='I'
      then
      if exists (select 0 from table where offid=_offid) then
      update table set (offid,hh,register,nameof,addres,cast,rel,typeof,nameofin,countr,
count,stat,state,dist,distn,vill,villa,villag,ward,hous,invest,create,modified)
=(_offid,_hh,_register,_nameof,_addres,_cast,_rel,_typeof,_nameofin,_countr,
_count,_stat,_state,_dist,_distn,_vill,_villa,_villag,_ward,_hous,_invest,_create,
_modified);

end if;
else
INSERT INTO table(offid,hh,register,nameof,addres,cast,rel,typeof,nameofin,countr,
count,stat,state,dist,distn,vill,villa,villag,ward,hous,invest,create,modified)
    VALUES (_offid,_hh,_register,_nameof,_addres,_cast,_rel,_typeof,_nameofin,_countr,
_count,_stat,_state,_dist,_distn,_vill,_villa,_villag,_ward,_hous,_invest,_create,
_modified);

end if;
      END;
  $BODY$

我的Java代码是:

 CallableStatement callableStatement = con.prepareCall("{  call ins_table_1(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");
  callableStatement.setString(1, "6908212019074035");
callableStatement.setString(2, "030801204220421000");
  callableStatement.setDate(3,  01/08/2015);
callableStatement.setString(4, "Yadv");
callableStatement.setString(5, "#2345, bibipur");
 callableStatement.setString(6, "genrl");
callableStatement.setString(7, "Hind");
 callableStatement.setString(8, "nuclear");
 callableStatement.setString(9, "gagz");
 callableStatement.setString(10, "99");
 callableStatement.setString(11, "gagz");
 callableStatement.setString(12, "03");
 callableStatement.setString(13, "UP");
 callableStatement.setString(14, "09");
 callableStatement.setString(15, "fatehk");
 callableStatement.setInt(2026, 16);
  callableStatement.setString(17, "Bibipur");
callableStatement.setString(18, "01");
 callableStatement.setInt(20, 19);
  callableStatement.setInt(100, 20);
 callableStatement.setInt(99, 21);
 callableStatement.setDate(22,  01/08/2015);
callableStatement.setDate(23,  01/08/2015);

callableStatement.setString(24, "I");

i =callableStatement.executeUpdate();

我在netbeans中遇到以下异常:

  org.postgresql.util.PSQLException: The column index is out of range: 3,456, number of columns: 24.
    at org.postgresql.core.v3.SimpleParameterList.bind(SimpleParameterList.java:56)
    at org.postgresql.core.v3.SimpleParameterList.setBinaryParameter(SimpleParameterList.java:122)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.bindBytes(AbstractJdbc2Statement.java:2298)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.setInt(AbstractJdbc2Statement.java:1287)
    at server.NewWebService.hello(NewWebService.java:275)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.glassfish.webservices.InstanceResolverImpl$1.invoke(InstanceResolverImpl.java:144)
    at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:149)
    at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:88)
    at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:1136)
    at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:1050)
    at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:1019)
    at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:877)
    at com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl.process(AbstractTubeImpl.java:136)
    at org.glassfish.webservices.MonitoringPipe.process(MonitoringPipe.java:142)
    at com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:119)
    at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:1136)
    at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:1050)
    at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:1019)
    at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:877)
    at com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl.process(AbstractTubeImpl.java:136)
    at com.sun.enterprise.security.webservices.CommonServerSecurityPipe.processRequest(CommonServerSecurityPipe.java:209)
    at com.sun.enterprise.security.webservices.CommonServerSecurityPipe.process(CommonServerSecurityPipe.java:141)
    at com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:119)
    at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:1136)
    at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:1050)
    at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:1019)
    at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:877)
    at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:419)
    at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:868)
    at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:422)
    at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:169)
    at org.glassfish.webservices.JAXWSServlet.doPost(JAXWSServlet.java:169)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:415)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:282)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
    at java.lang.Thread.run(Thread.java:745)

任何人都知道这种类型的例外吗?

0 个答案:

没有答案