zoukankan      html  css  js  c++  java
  • MyBatis 调用存储过程

    sqlxml,这里面的call 与后面不能换行;

    <select id="getPersonCount" parameterMap="getPCMap"
            statementType="CALLABLE">
            CALL test.get_user_count(?,?)
        </select>
        <parameterMap type="java.util.Map" id="getPCMap">
            <parameter property="idtype" jdbcType="INTEGER" mode="IN" />
            <parameter property="usercount" jdbcType="INTEGER" mode="OUT" />
        </parameterMap>

    test

    statement = "PersonCondition.getPersonCount";
                Map<String, Integer> parameterMap = new HashMap<String, Integer>();
                parameterMap.put("idtype", 0);
                parameterMap.put("usercount", -1);
    
                sqlSession.selectOne(statement, parameterMap);
                
                Integer integer = parameterMap.get("usercount");
                System.out.println(integer);

    procedure

    BEGIN
    IF id1=0 THEN
    select count(*) from person where  id > 15 into count_id;
    ELSE
    select count(*) from person where  id < 15 into count_id;
    end IF;
    END
  • 相关阅读:
    UVa 106
    UVa 111
    UVa 105
    UVa 104
    UVa 103
    UVa 102
    UVa 101
    UVa 100
    就决定是你了!
    阿姆斯特朗回旋加速喷气式阿姆斯特朗炮
  • 原文地址:https://www.cnblogs.com/stono/p/4480040.html
Copyright © 2011-2022 走看看