首先给大家分享一个巨牛巨牛的人工智能教程,是我无意中发现的。教程不仅零基础,通俗易懂,而且非常风趣幽默,还时不时有内涵段子,像看小说一样,哈哈~我正在学习中,觉得太牛了,所以分享给大家!点这里可以跳转到教程
一、Mybatis调用存储过程
1 在数据库中创建以下的存储过程
create or replace procedure pro_hello(p_user_name in varchar2,p_result out varchar2) is
begin
p_result := 'hello,' || p_user_name;
end;
2 编写SQL映射文件mapper.xml
statementType里的CALLABLE是标注此sql为存储过程。
parameterType是标注要传的参数,看了一些资料不写parameterType的话默认传map。还是加上比较清晰
<select id="proHello" parameterType="java.util.map" statementType="CALLABLE">
{call pro_hello(#{uname,mode=IN,jdbcType=VARCHAR},#{result,mode=OUT,jdbcType=VARCHAR})}
</select>
3 编写JAVA代码调用存储过程
public class ProcedureT
1 在数据库中创建以下的存储过程
create or replace procedure pro_hello(p_user_name in varchar2,p_result out varchar2) is
begin
p_result := 'hello,' || p_user_name;
end;
2 编写SQL映射文件mapper.xml
statementType里的CALLABLE是标注此sql为存储过程。
parameterType是标注要传的参数,看了一些资料不写parameterType的话默认传map。还是加上比较清晰
<select id="proHello" parameterType="java.util.map" statementType="CALLABLE">
{call pro_hello(#{uname,mode=IN,jdbcType=VARCHAR},#{result,mode=OUT,jdbcType=VARCHAR})}
</select>
3 编写JAVA代码调用存储过程
public class ProcedureT