NutzCN Logo
问答 调用SqlServer存储过程出错,是不是出参写错了?
发布于 2377天前 作者 qq_7fafbecc 1277 次浏览 复制 上一个帖子 下一个帖子
标签:
		Sql sql = Sqls.create("CALL PDA_SCAN_BAGCODE(@BagCode, @CheckerCode,@SingerCode,@DepartmentCode,@OUTReturnCode,@OUTReturnText)");
		//Sql sql = Sqls.create("CALL PDA_SCAN_BAGCODE(@@BagCode, @@CheckerCode,@@SingerCode,@@DepartmentCode,@OUT@ReturnCode,@OUT@ReturnText)");
	    sql.setEntity(dao.getEntity(Record.class));
	    sql.params().set("BagCode", "0000000005"); // 设置入参
	    sql.params().set("CheckerCode", "0001"); // 设置入参
	    sql.params().set("SingerCode", "0001"); // 设置入参
	    sql.params().set("DepartmentCode", "1"); // 设置入参
	    sql.params().set("OUTReturnCode", Types.INTEGER);// 设置出参类型,注意,必须加OUT开头
	    sql.params().set("OUTReturnText", Types.VARCHAR);// 设置出参类型,注意,必须加OUT开头
	    dao.execute(sql);
	    Record re = sql.getOutParams();
	    System.out.println(Json.toJson(re));
2018-06-20 15:41:49,840 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - CALL PDA_SCAN_BAGCODE(?, ?,?,?,?,?)
    |          1 |    2 |    3 | 4 | 5 |  6 |
    |------------|------|------|---|---|----|
    | 0000000005 | 0001 | 0001 | 1 | 4 | 12 |
  For example:> "CALL PDA_SCAN_BAGCODE('0000000005', '0001','0001','1',4,12)"
2018-06-20 15:41:49,841 org.nutz.dao.impl.sql.run.NutDaoExecutor._runExec(NutDaoExecutor.java:118) DEBUG - CALL PDA_SCAN_BAGCODE(?, ?,?,?,?,?)
2018-06-20 15:41:49,917 org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:97) DEBUG - SQLException
com.microsoft.sqlserver.jdbc.SQLServerException: '@P0' 附近有语法错误。
	at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:197)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1493)
	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:390)
	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:340)
	at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4874)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1400)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:179)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:154)
	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.execute(SQLServerPreparedStatement.java:322)
	at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:493)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor._runExec(NutDaoExecutor.java:152)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:68)
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:66)
	at org.nutz.dao.impl.interceptor.DaoLogInterceptor.filter(DaoLogInterceptor.java:22)
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:64)
	at org.nutz.dao.DaoInterceptorChain.invoke(DaoInterceptorChain.java:139)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.runCallback(NutDaoRunner.java:158)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithTransaction(NutDaoRunner.java:104)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:88)
	at org.nutz.dao.impl.sql.run.NutDaoRunner$1.run(NutDaoRunner.java:74)
	at org.nutz.trans.Trans.exec(Trans.java:174)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:72)
	at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:240)
	at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:248)
	at org.nutz.dao.impl.DaoSupport.execute(DaoSupport.java:236)
	at org.nutz.dao.impl.NutDao.execute(NutDao.java:973)
	at com.shlx.blood.service.interf.PdaServiceBo.doReceipt(PdaServiceBo.java:109)
	at com.shlx.blood.service.interf.PdaServiceBo$$NUTZAOP._aop_invoke(PdaServiceBo.java:1)
	at org.nutz.aop.InterceptorChain.invoke(InterceptorChain.java:77)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:57)
	at org.nutz.aop.interceptor.TransactionInterceptor.filter(TransactionInterceptor.java:34)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
	at com.shlx.blood.service.interf.PdaServiceBo$$NUTZAOP.doReceipt(PdaServiceBo.java:1)
	at com.shlx.blood.service.business.SysConfigService.saveSysConfig(SysConfigService.java:147)
	at com.shlx.blood.service.business.SysConfigService$$NUTZAOP._aop_invoke(SysConfigService.java:2)
	at org.nutz.aop.InterceptorChain.invoke(InterceptorChain.java:77)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:57)
	at org.nutz.aop.interceptor.TransactionInterceptor.filter(TransactionInterceptor.java:34)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
	at com.shlx.blood.aop.ServiceInterceptor.filter(ServiceInterceptor.java:48)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
	at com.shlx.blood.service.business.SysConfigService$$NUTZAOP.saveSysConfig(SysConfigService.java:1)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.nutz.lang.Invoking$DefaultInvoker.invoke(Invoking.java:47)
	at org.nutz.lang.Invoking.invoke(Invoking.java:192)
	at org.nutz.lang.Mirror.invoke(Mirror.java:1100)
	at com.shlx.blood.service.ComServices.ExcuteServices(ComServices.java:140)
	at com.shlx.blood.action.business.SysConfigAction.saveSysConfig(SysConfigAction.java:60)
	at com.shlx.blood.action.business.SysConfigAction$$FASTCLASS._invoke(SysConfigAction.java:1)
	at org.nutz.lang.reflect.AbstractFastClass.invoke(AbstractFastClass.java:143)
	at org.nutz.lang.reflect.FastClassFactory.invoke(FastClassFactory.java:67)
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:27)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:33)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at com.shlx.blood.mvc.SessionCheckProcessor.process(SessionCheckProcessor.java:56)
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:198)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:474)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:783)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:798)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1434)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Unknown Source)
2018-06-20 15:41:52,388 com.shlx.blood.service.ComServices.ExcuteServices(ComServices.java:143) DEBUG - Fail to invoke [com.shlx.blood.service.business.SysConfigService$$NUTZAOP].saveSysConfig() by args:
 {}
For the reason: 提交数据时出错:!Nutz SQL Error: 'CALL PDA_SCAN_BAGCODE('0000000005', '0001','0001','1',4,12)'
PreparedStatement: 
'CALL PDA_SCAN_BAGCODE(?, ?,?,?,?,?)'
CaseMessage='@P0' 附近有语法错误。
org.nutz.lang.InvokingException: Fail to invoke [com.shlx.blood.service.business.SysConfigService$$NUTZAOP].saveSysConfig() by args:
 {}
For the reason: 提交数据时出错:!Nutz SQL Error: 'CALL PDA_SCAN_BAGCODE('0000000005', '0001','0001','1',4,12)'
PreparedStatement: 
'CALL PDA_SCAN_BAGCODE(?, ?,?,?,?,?)'
CaseMessage='@P0' 附近有语法错误。
1 回复
"{call XXX }"
添加回复
请先登陆
回到顶部