zoukankan      html  css  js  c++  java
  • DB 与oracle 批量新增的写法

    DB

    public int batchInsertOrg(@Param(value = "list") List<Org> list);

    <insert id="batchInsertJczdbOrg">  
        insert into DT_ORG(  
        org_code,
        org_name
        )
        values  
        <foreach collection="list" item="item" index="index" separator="," >  
        (#{item.org_code,jdbcType=VARCHAR},
         #{item.org_name,jdbcType=VARCHAR}  
         )     
        </foreach>  
      </insert> 

    oracle

    public int batchInsertJczdbEnterprise(@Param(value = "list") List<JczdbEnterprise> list);

    <insert id="batchInsertJczdbEnterprise" parameterType="java.util.List">
         insert into DT_JCZDB_ENTERPRISE(  
            code,
            num_member,
            org_type,
            establish_date,
            address,
            social_num,
            recursive_org
        )
            select A.* FROM (
                <foreach collection="list" item="item" index="index" separator="UNION" >  
                   SELECT
                    #{item.code,jdbcType=VARCHAR},
                    #{item.num_member,jdbcType=INTEGER},
                    #{item.org_type,jdbcType=INTEGER},
                    #{item.establish_date,jdbcType=DATE} ,
                    #{item.address,jdbcType=VARCHAR},
                    #{item.social_num,jdbcType=INTEGER},
                    #{item.recursive_org,jdbcType=VARCHAR} from dual  
                </foreach>
            ) A
        </insert>

  • 相关阅读:
    让网络更轻盈——网络功能虚拟化技术的现状和未来(中兴通讯)
    服务链(Service Chaining,or Service Function Chaining,SFC,功能服务链)
    中间件(middlebox)
    OpenStack 简介
    数据库系统原理——ER模型与关系模型
    Google 面试
    可扩展性 Scalability
    pay-as-you-go
    Java 自动装箱与拆箱(Autoboxing and unboxing)
    齐次坐标的理解
  • 原文地址:https://www.cnblogs.com/523823-wu/p/7878812.html
Copyright © 2011-2022 走看看