码迷,mamicode.com
首页 > 数据库 > 详细

oracle 排序字段自增长

时间:2017-10-31 20:40:41      阅读:232      评论:0      收藏:0      [点我收藏+]

标签:iss   sde   code   bsp   活动   sel   rom   nextval   sort   

<insert id="insertGoodsDescription" parameterClass="goodsDescription" >
        <selectKey resultClass="int" keyProperty="serviceDescriptionId" >  
            SELECT goods_description_SEQ.nextval AS service_description_id  from dual
        </selectKey>
       insert into product_service_description (
        service_description_id, 
        label_name, 
        label_icon,
        label_description,
        sort_num,
        product_id,
        is_default,
        is_delete,
        ADD_TIME,
        ADD_USER_ID,
        EDIT_TIME, 
        EDIT_USER_ID)
        values (
        #serviceDescriptionId#,
        #labelName#,
        #labelIcon#,
        #labelDescription#,
      nvl (#sortNum#,  (
        SELECT MAX(sort_num) + 1
        FROM product_service_description) ),
       
        <!--#sortNum#,-->
        #productId#,
        #isDefault#,
        N,
        #addTime#,
        #addUserId#,
        #editTime#,
        #editUserId#
        )
    </insert>
<!-- 添加微信团活动 -->
    
    <insert id="save" parameterType="WeixinActivity">
   
    INSERT INTO  weixin_activity
    (
     WEIXIN_NAME,
     BANNER_IMG_URL,
     START_TIME,
     END_TIME , 
     GROUP_PRICE,
     DISCOUNT_LAB,
     MINIMUM_JOIN_MEMBER_NUM,
     ORDER_BY,
     IS_STATUS,
     BEGIN_WAIT_TIME,
     ADD_USER_ID,
     EDIT_TIME,
     IS_DELETE,
     ADD_TIME,
     EDIT_USER_ID
     ) values
    ( 
    #{weixinName},
    #{bannerImgUrl},
    #{startTime},
    #{endTime},
    #{groupPrice},
    #{discountLab},
    #{minimumJoinMemberNum},
    IFNULL(#{sortBy},  (
        SELECT id
        FROM (
        SELECT MAX(order_by) + 1 AS id
        FROM weixin_activity) t)),
    
    
<!--         (select id from   -->
<!--    (SELECT MAX(order_by) + 1 as id FROM weixin_activity) t), -->
   
    #{isStatus},
    #{beginWaitTime},
    #{addUserId},
    #{editTime},
    N,
    #{addTime},
    #{editUserId}
    )
  </insert>

 

oracle 排序字段自增长

标签:iss   sde   code   bsp   活动   sel   rom   nextval   sort   

原文地址:http://www.cnblogs.com/wangchuanfu/p/7763492.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!