mybatis调用mysql存储过程,得到null,求帮助

Dao层

 int instertUserWeight(@Param("_uid") Integer uid,@Param("_gid") Integer gid,@Param("_count") Long count,@Param("_result") Integer result);

Mapping层

<select id="instertUserWeight" parameterType="map" statementType="CALLABLE" resultMap="BaseResultMap">
    {CALL proc_BetWeightSave(
      #{_uid,mode=IN,jdbcType=INTEGER},
      #{_gid,mode=IN,jdbcType=INTEGER},
      #{_count,mode=IN,jdbcType=BIGINT},
      #{_result,mode=OUT,jdbcType=INTEGER}
    )}
  </select>

存储过程
图片说明
运行结果是2
可是我用mybatis调用的时候拿到的是null
attempted to return null from a method with a primitive return type (int).

** 求帮助**

0

2个回答

这个问题是由resultmap造成的,应该改成resulttype
,好吧还是自己解决了

0
0
v_Cloud
v_Cloud 我和他应该不是同个错误吧
接近 2 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
mybatis调用mysql存储过程的例子
环境: JDK1.7,MySQL 5.6,windows7 存储过程SQL如下: CREATE  PROCEDURE `saveTender`(IN brwId  VARCHAR(26),IN money VARCHAR(26),IN userid  VARCHAR(26),IN ordid  VARCHAR(20),OUT pResult VARCHAR(512))   
Mybatis调用MySQL存储过程
1.存储过程的简介我们常用的操作数据库语言SQL语句在执行的时候需要要先编译,然后执行,而存储过程(Stored Procedure)是一组为了完成特定功能的SQL语句集,经编译后存储在数据库中,用户通过指定存储过程的名字并给定参数(如果该存储过程带有参数)来调用执行它。一个存储过程是一个可编程的函数,它在数据库中创建并保存。它可以有SQL语句和一些特殊的控制结构组成。当希望在不同的应用程序或平台...
MyBatis调用Mysql存储过程
&amp;lt;!-- 删除用户 【存储过程】--&amp;gt; &amp;lt;delete id=&quot;delUser&quot; parameterType=&quot;java.lang.String&quot; statementType=&quot;CALLABLE&quot;&amp;gt; { call proc_del_user(#{userId}) } &amp;lt;/delete&amp;gt;就多了个参数:statementType=&quot;CALLA
Mybatis调用mysql存储过程
建立存储过程: DELIMITER $$ USE `test`$$ DROP PROCEDURE IF EXISTS `user_user_selectUserByProAndCity_sp`$$ CREATE DEFINER=`demao`@`%` PROCEDURE `user_user_selectUserByProAndCity_sp`(IN provinceId INT,IN c
Mybatis调用Mysql存储过程
在我的后台系统中,今天需要使用到存储过程。存储过程还真没写过,今天就写了个存储过程。使用在后台中。 其实这个接口功能 是涉及几张表的修改,删除,新增的。就写个一个存储过程。 存储过程: 1 CREATE PROCEDURE `sp_combine_admin_group`(IN `group_id1` int(11), IN `group_id2` int(11),IN `admi...
mybatis调用mysql存储过程
mybatis调用mysql中的存储过程方法详解
Mybatis调用MySQL存储过程的简单实现
1.存储过程的简介 我们常用的操作数据库语言SQL语句在执行的时候需要要先编译,然后执行,而存储过程(Stored Procedure)是一组为了完成特定功能的SQL语句集,经编译后存储在数据库中,用户通过指定存储过程的名字并给定参数(如果该存储过程带有参数)来调用执行它。 一个存储过程是一个可编程的函数,它在数据库中创建并保存。它可以有SQL语句和一些...
mybatis调用MySQL存储过程
一、建表 CREATE TABLE test.t_sequence (   name varchar(50) NOT NULL COMMENT 'sequence名称',   currentvalue bigint(20) NOT NULL COMMENT 'sequence当前值',   increment int(10) NOT NULL COMMENT 'sequence每次增长
mysql存储过程且mybatis调用
  首先,需要执行符DELIMITER ,建议用//,即在存储过程开始前定义delimiter//,在结束后加上//,最后加上DELIMITER; 具体原因@参考文章1写的很清楚,不再赘述。 参考文章1中的示例: delimiter //; -- 改变 MySQL delimiter 为:“//” drop procedure if exists pr_st...
MyBatis调用MYSQL存储过程
MyBatis调用MYSQL存储过程 返回多行 引用的包: asm-3.1.jar cglib-2.2.jar commons-logging-1.1.1.jar log4j-1.2.13.jar mybatis-3.0.4.jar mysql-connector-java-5.1.13.jar slf4j-api-1.5.8.jar slf4j-log4j12-1.5.8.jar
MyBatis调用MySQL存储过程
业务背景: 机构ID:省(360000),市级(360100),区县级(360101) 输入一个机构ID(可能是区,也可能是市)在sys_ability_warning_rule表中查询对应机构ID, 如:输入360305(区县级), 如果表中有对应ID,则直接返回360305, 如果没有对应ID,则查询有没有市级ID(360300),如果有,则返回360300, 如果市级ID也没有,...
mybatis调用mysql存储过程返回结果集
存储过程中经常需要返回结果集。 Mysql 中直接用 select 即可返回结果集。而 oracle 则需要使用游标来返回结果集。这一点 Mysql 相对比较方便,如下代码即可实现输出结果集: 存储过程定义: DELIMITER $$ DROP procedure IF EXISTS pro_sql_data1 $$ CREATE procedure pro_sql_data1(in s
mybatis调用mysql存储过程时报错
rn rn rn rn rn rn rn rn rn rn CALL pro_getChildList(rn #pId,jdbcType=VARCHAR,mode=IN,rn #colName,jdbcType=VARCHAR,mode=IN,rn #colPname,jdbcType=VARCHAR,mode=IN,rn #tName,jdbcType=VARCHAR,mode=IN,rn #outColName,jdbcType=VARCHAR,mode=IN,rn #retVal,jdbcType=VARCHAR,mode=OUT,rn #userCount,jdbcType=INTEGER,mode=OUTrn )rn rn 在本机跟测试mysql 5.6.36中可以正常运行,但放到生产环境中,mysql版本为5.6.44时会抛出错误rn rnstd [0523 14:45:27 ERROR: druid.sql.Statement - conn-10020, cstmt-20014 execute error. CALL pro_getChildList(rn ?,rn ?,rn ?,rn ?,rn ?,rn ?,rn ?rn )rn com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1rn at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)rn at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)rn at java.lang.reflect.Constructor.newInstance(Constructor.java:423)rn at com.mysql.jdbc.Util.handleNewInstance(Util.java:407)rn at com.mysql.jdbc.Util.getInstance(Util.java:382)rn at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052)rn at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3603)rn at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3535)rn at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1989)rn at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2150)rn at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2626)rn at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119)rn at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1362)rn at com.mysql.jdbc.CallableStatement.execute(CallableStatement.java:908)rn at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2931)rn at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440)rn at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929)rn at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440)rn at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929)rn at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:118)rn at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:493)rn at org.apache.ibatis.executor.statement.CallableStatementHandler.query(CallableStatementHandler.java:67)rn at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)rn at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:498)rn at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63)rn at com.sun.proxy.$Proxy224.query(Unknown Source)rn at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:498)rn at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63)rn at com.sun.proxy.$Proxy224.query(Unknown Source)rn at org.apache.ibatis.executor.ReuseExecutor.doQuery(ReuseExecutor.java:60)rn at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325)rn at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)rn at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)rn at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83)rn at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)rn at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)rn at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:77)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:498)rn at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:434)rn at com.sun.proxy.$Proxy38.selectOne(Unknown Source)rn at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:167)rn at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:75)rn at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53)rn at com.sun.proxy.$Proxy74.getChildDeptAndCountByParentId(Unknown Source)rn at com.concom.yunzq.impl.service.user.DepartmentServiceImpl.queryChildDeptAndCountByParentId(DepartmentServiceImpl.java:846)rn at com.concom.yunzq.impl.service.user.DepartmentServiceImpl$$FastClassBySpringCGLIB$$5153dd20.invoke()rn at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)rn at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:652)rn at com.concom.yunzq.impl.service.user.DepartmentServiceImpl$$EnhancerBySpringCGLIB$$adbc1137.queryChildDeptAndCountByParentId()rn at com.alibaba.dubbo.common.bytecode.Wrapper77.invokeMethod(Wrapper77.java)rn at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:46)rn at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:72)rn at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:53)rn at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:64)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:42)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:78)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.concom.yunzq.dubbo.BaseFilter.invoke(BaseFilter.java:85)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:70)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:132)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:38)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:113)rn at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:84)rn at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:170)rn at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:52)rn at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:82)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)rn at java.lang.Thread.run(Thread.java:748)rnstd [0523 14:45:27 ERROR: com.alibaba.dubbo.rpc.filter.ExceptionFilter - [DUBBO] Got unchecked and undeclared exception which called by 172.21.4.80. service: com.concom.yunzq.service.user.IDepartmentService, method: queryChildDeptAndCountByParentId, exception: org.springframework.jdbc.BadSqlGrammarException: rn### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1rn### The error may exist in file [D:\ouyang\tomcat\branch\apache-tomcat-8.5.39\webapps\METRO_YUNZQ_SERVICE_IMPL\WEB-INF\classes\config\mybatis\mappers\user\Department_mapper.xml]rn### The error may involve com.concom.yunzq.impl.dao.user.DepartmentDao.callMaprn### The error occurred while setting parametersrn### SQL: CALL pro_getChildList( ?, ?, ?, ?, ?, ?, ? )rn### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1rn; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1, dubbo version: 2.8.4, current host: 172.21.4.80rnorg.springframework.jdbc.BadSqlGrammarException: rn### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1rn### The error may exist in file [D:\ouyang\tomcat\branch\apache-tomcat-8.5.39\webapps\METRO_YUNZQ_SERVICE_IMPL\WEB-INF\classes\config\mybatis\mappers\user\Department_mapper.xml]rn### The error may involve com.concom.yunzq.impl.dao.user.DepartmentDao.callMaprn### The error occurred while setting parametersrn### SQL: CALL pro_getChildList( ?, ?, ?, ?, ?, ?, ? )rn### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1rn; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1rn at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:231)rn at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)rn at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75)rn at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:447)rn at com.sun.proxy.$Proxy38.selectOne(Unknown Source)rn at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:167)rn at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:75)rn at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53)rn at com.sun.proxy.$Proxy74.getChildDeptAndCountByParentId(Unknown Source)rn at com.concom.yunzq.impl.service.user.DepartmentServiceImpl.queryChildDeptAndCountByParentId(DepartmentServiceImpl.java:846)rn at com.concom.yunzq.impl.service.user.DepartmentServiceImpl$$FastClassBySpringCGLIB$$5153dd20.invoke()rn at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)rn at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:652)rn at com.concom.yunzq.impl.service.user.DepartmentServiceImpl$$EnhancerBySpringCGLIB$$adbc1137.queryChildDeptAndCountByParentId()rn at com.alibaba.dubbo.common.bytecode.Wrapper77.invokeMethod(Wrapper77.java)rn at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:46)rn at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:72)rn at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:53)rn at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:64)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:42)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:78)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.concom.yunzq.dubbo.BaseFilter.invoke(BaseFilter.java:85)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:70)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:132)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:38)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:113)rn at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:84)rn at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:170)rn at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:52)rn at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:82)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)rn at java.lang.Thread.run(Thread.java:748)rnCaused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1rn at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)rn at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)rn at java.lang.reflect.Constructor.newInstance(Constructor.java:423)rn at com.mysql.jdbc.Util.handleNewInstance(Util.java:407)rn at com.mysql.jdbc.Util.getInstance(Util.java:382)rn at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052)rn at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3603)rn at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3535)rn at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1989)rn at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2150)rn at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2626)rn at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119)rn at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1362)rn at com.mysql.jdbc.CallableStatement.execute(CallableStatement.java:908)rn at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2931)rn at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440)rn at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929)rn at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440)rn at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929)rn at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:118)rn at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:493)rn at org.apache.ibatis.executor.statement.CallableStatementHandler.query(CallableStatementHandler.java:67)rn at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)rn at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:498)rn at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63)rn at com.sun.proxy.$Proxy224.query(Unknown Source)rn at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:498)rn at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63)rn at com.sun.proxy.$Proxy224.query(Unknown Source)rn at org.apache.ibatis.executor.ReuseExecutor.doQuery(ReuseExecutor.java:60)rn at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325)rn at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)rn at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)rn at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83)rn at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)rn at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)rn at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:77)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:498)rn at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:434)rn ... 40 more
mybatis调用mysql存储过程,带结果集
存储过程中经常需要返回结果集。 MySQL 中直接用 select 即可返回结果集。而 Oracle 则需要使用游标来返回结果集。这一点 MySQL 相对比较方便,如下代码即可实现输出结果集: mybatis调用service层需要注意增加 @Transactional(readOnly = false),放开事务写功能service@Transactional(readOnly = false)
mybatis调用mysql存储过程(返回值问题)
一、xml配置文件有两种写法 1、 &lt;select id="getSeedValue" parameterMap="seedMap" statementType="CALLABLE"&gt; {call PROC_SEQ_SEED_GET(?,?,?,?,?)} &lt;/select&gt; &lt;parameterMap id="seedMap" ...
MyBatis:MyBatis操作MySQL存储过程
MyBatis:MyBatis操作MySQL存储过程 一 . 数据库中创建存储过程,并查看创建结果 1.创建存储过程 DROP procedure IF EXISTS net_procedure_request; DELIMITER $$ CREATE procedure net_procedure_request(in select_type varchar(99),in select_cli...
求c++ 调用mysql存储过程的方法
再用mysql存储过程,网上用c api调用的例子比较少rn请问谁有一些调用例子,不胜感激,谢谢
C#调用mysql存储过程出现奇葩问题,求帮助
[img=https://img-bbs.csdn.net/upload/201507/24/1437729772_352800.jpg][/img]rnrn存储过程rnrnDROP PROCEDURE IF EXISTS `proc_QryTid`; rnCREATE PROCEDURE proc_QryTid(IN pTID VARCHAR(50),OUT ifExist INT) rnBEGIN rn select count(*) into ifExist from tid_record where TID=pTID;rnEND ; rnrnCALL proc_QryTid('E280 1130 2000 1002 68E8 00A9',@a);rnselect @a;rnrnrn[img=https://img-bbs.csdn.net/upload/201507/24/1437729884_729701.jpg][/img]rnrnrnC# 程序中调用代码rn public String Proc_QryToTID(String TID)rn rn String result = "0";rn tryrn rn mysqlConnection.Open();rn MySqlCommand mysqlCommand = new MySqlCommand("proc_QryTid", mysqlConnection);rn mysqlCommand.CommandType = CommandType.StoredProcedure;rnrn mysqlCommand.Parameters.Add("@pTID", MySqlDbType.VarChar).Value = TID;rn mysqlCommand.Parameters["@pTID"].Direction = ParameterDirection.Input;rnrn mysqlCommand.Parameters.Add("@ifExist", MySqlDbType.Int32).Value = 0;rn mysqlCommand.Parameters["@ifExist"].Direction = ParameterDirection.Output;rnrn mysqlCommand.ExecuteNonQuery();rnrn result = mysqlCommand.Parameters["@ifExist"].Value.ToString();rn return result;rn rnrn catch (MySqlException ex)rn rn Console.WriteLine("MySqlException Error:" + ex.ToString());rn if (Regex.IsMatch(ex.ToString(), ""))rn rn MessageBox.Show("查询TID失败");rn rn return result;rn rn finallyrn rn mysqlConnection.Close();rn rn rnrnrn[img=https://img-bbs.csdn.net/upload/201507/24/1437730061_407110.jpg][/img]rnrn这个结果怎么会是 1 !!!! 无论怎么查,有还是没有结果都是 1 ????rn但是在数据库里面 直接调用 就没问题,有没有大侠解惑rn
mybatis调用mysql存储过程并获取返回值
1、mysql创建存储过程 #结束符号默认;, delimiter $$语句表示结束符号变更为$$ delimiter $$ CREATE PROCEDURE `demo`(IN idno VARCHAR(100), out str VARCHAR(4000)) BEGIN SET str = ''; set str = concat(str, "SELECT count(DISTINCT `pe...
MyBatis—调用mysql存储过程 带输出输入参数
存储过程都是一样的,只是根据自己的喜好,可以用MAP或者JAVABEAN传递参数。 -- -------------------------------------------------------------------------------- -- Routine DDL -- Note: comments before and after the routine body will not
MyBatis 调用MySql存储过程处理树形结构结果集
背景在做部门管理的时候,部门可以有父部门和子部门,这是个典型的树形结构。在选择一个部门的父部门时需要排除其所有子部门。如A12的可选父部门就是红圈外的所有部门。 框架mybatis 3.2.8 mysql 5.7 springMVC 由于mybatis中没有oracle中那么多省力的函数,我需要拿到所有可选父部门的id,名称,父部门名称,送到前端用zTree显示。所以需要手写存储过程去拿到结果集再组
mybatis 调用mysql存储过程 带输出输入参数
首先感谢网络上以为朋友。其实我不认识。看到他的博客才做出来。 http://lohasle.iteye.com/blog/1669879 他的地址。下面的是我一些简单拓展的     存储过程都是一样的,只是根据自己的喜好,可以用MAP或者JAVABEAN传递参数。 Sql代码   -- --------------------------------------------------...
mysql存储过程+mybatis调用返回多条数据
大致流程是在mysql中新建一个存储过程然后DELIMITER$ create PROCEDURE jysapp.get_second_member(IN user_id int) BEGIN SELECT id,username,phonenum,registertime,str1 FROM jysapp.user where user.pid = user_id; end mybatis中的
Mysql存储过程及调用
存储过程:存储过程是SQL 语句和可选控制流语句的预编译集合,以一个名称存储并作为一个单元处理。存储过程存储在数据库内,可由应用程序通过一个调用执行,而且允许用户声明变量、有条件执行以及其它强大的编程功能。存储过程在创建时即在服务器上进行编译,所以执行起来比单个SQL语句快。存储过程的优缺点: 优点:1.存储过程只在创造时进行编译,以后每次执行存储过程都不需再重新编译,而一般SQL语句每执...
Mysql存储过程调用
前言 博主github 博主个人博客http://blog.healerjean.com 准备数据 CREATE TABLE `demo_entity` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL, `age` bigint(20) DEF...
调用mysql存储过程
一、存储过程有输入有输出参数,三个参数都为int 二、java代码片段 Connection conn =DriverManager.getConnection(url, user, password); CallableStatement cs= conn.prepareCall("call proc_oper_art(0, 14, ?)");       -- 0,14是输入参数,?是输
MySql存储过程及调用
存储过程: CREATE PROCEDURE `select_AppraiseShow_Panel3_2`(IN p_id INT,IN year_start VARCHAR(20),IN year_over VARCHAR(20),IN selUnit varchar(50),IN pageNo INTEGER,IN pageSize INTEGER,OUT totalSize INTEG
mySQL存储过程调用
php中调用MySQL存储过程示例
mysql存储过程调用
<br />创建:<br /> <br />CREATE PROCEDURE `abc`(IN tname char(20),in tpass char(20))<br />BEGIN<br />  INSERT INTO t_user (name,pass) values(tname,tpass);<br />END;<br /> <br />调用:<br />call pro_name(value1,value2);<br /> <br />java中调用:<br />package test;<br
MYSQL存储过程和调用
工作中用到的逻辑写成存储过程来用 CREATE PROCEDURE `pro_getLibCount`(IN qtype INTEGER(11),IN qdesc varchar(50),IN qversion varchar(50),IN qname varchar(50),IN qpath varchar(50),IN qxml varchar(50),OUT libcount INTE...
mysql存储过程及调用
写存储过程方法很多: 下面我写的是比较传统的命令下操作: 进入mysql bin目录 输入:delimiter //            create procedure two()             begin              select * from lw_test order by id desc;              end            
【Mybatis学习】Mybatis学习之调用Mysql存储过程(1传入2输出)
Mybatis调用MySql中的存储过程(1传入2输出)1.定义存储过程目标数据库表结构:存储过程:直接用语句执行总出现错误,暂时没解决,大致如下:CREATE OR REPLACE PROCEDURE findByUname(uname VARCHAR(255),OUT sid INT,OUT rname VARCHAR(255)) BEGIN SELECT id,real_name i...
MyBatis,MySql存储过程分页查询
前言一般我们使用MyBatis时进行分页主要通过使用PageHelper这个插件。但某些时候,在某些公司可能会遇到跨库查询并分页显示的场景,这时就无法在使用PageHelper了。如果待查询的MySql不同库在一台机器上那么可以通过 数据库名.表明 的形式来进行跨库查询,这是可以通过存储过程来完成查询。 编写存储过程 以学生信息查询为例,例如有两个库。 学生库student(学生信息表 stu_i
MyBatis使用MySQL存储过程
1、项目结构2、创建存储过程3、在StudentMapper.xml文件里配置映射语句&amp;lt;select id = &quot;callById&quot; resultMap = &quot;result&quot; parameterType = &quot;Student&quot; statementType = &quot;CALLABLE&quot;&amp;gt; {call read_recordById(#{id, jdbcType = INTEGER, ...
Mybatis应用mysql存储过程查询数据
1.创建mysql存储过程,这是个复杂查询加上了判断,比较复杂 CREATE PROCEDURE searchAllList ( IN tradingAreaId VARCHAR (50), IN categoryName VARCHAR (100), IN intelligenceSort TINYINT UNSIGNED, IN priceBegin DOUBLE, IN pric
mybatis对mysql存储过程的处理
由于前一段时间公司特别的忙,所以博客就没有继续更新了。现在有点空闲的时间了,想记录下mybatis的存储过程的用法.在之前mybatisplus升级到2.14了,他所带来的的特性很强大,可以实现了对象关系型的操作,和hibernate的很相识,他是mybatis的增强版,有兴趣的可以到他官网去逛逛,我之前用过,很爽。现在进入正题,我们都知道,减库存以及加库存是一个同步的过程,一方处理失败就得回滚的
mybatis操作mysql存储过程
之前没有用mybatis操作mysql存储过程,一般都是用ibatis操作oracle存储过程,两者的差距还是蛮大的,mysql的存储过程语法和oracle都不一样。以下为代码片断(spring MVC+mybatis+MySQL): package com.letu.dao; import java.util.List; import java.util.Map; impor...
mybatis 中 使用MYSQL存储过程
#mybatis 中 使用MYSQL存储过程; ##1.有学生表student(id,name,age,money) ##2.创建查询学生表信息的存储过程: ``` delimiter | create Procedure showAllstu() BEGIN SELECT * FROM student ORDER BY id DESC LIMIT 6; EN...
求mysql存储过程
在mysql中用存储过程实现oracle的sequence 达到Id自增的效果。rn存储过程能实现:有返回的Id号,即自增的Id。。
如何得到mysql存储过程的列表
select name,db from mysql.proc;还得知了存储过程的名称长度为64个字节,多于64则自动删除。 
相关热词 c# 线程顺序 c#昨天当前时间 c# 多进程 锁 c#mysql图片存取 c# ocx 委托事件 c# 读取类的属性和值 c# out 使用限制 c#获取url的id c#怎么进行分页查询 c# update 集合