您当前的位置: 首页 >  童心同萌

merge

童心同萌 发布时间:2018-05-03 11:24:41 ,浏览量:3

	/**
	 * 将bom_libpartattr表中的weight、cost、gmt_created分别移到
	 * bom_refreshattr表中的this_weight、this_cost、this_refresh_time
	 */
	public void refreshCostAndWeight() {
		String sql = "  MERGE INTO bom_refreshattr bre "
					+ " USING bom_libpartattr bli "
					+ " ON (bre.partpn=bli.partpn) "
					+ " WHEN MATCHED THEN "
					+ " 	UPDATE "
					+ " 	SET bre.this_weight = bli.weight,"
					+ " 		bre.this_cost = bli.cost,"
					+ " 		bre.this_refresh_time = bli.gmt_created "
					+ " WHEN NOT MATCHED THEN "
					+ " 	INSERT (bre.id,bre.gmt_created,bre.gmt_modified,bre.partpn,bre.this_weight,bre.this_cost,bre.this_refresh_time) "
					+ " 	VALUES (hibernate_sequence.nextval,sysdate,sysdate,bli.partpn,bli.weight,bli.cost,bli.gmt_created)";
		createSQLQuery(sql).executeUpdate();
	}

 

 

 

关注
打赏
1688896170
查看更多评论

童心同萌

暂无认证

  • 3浏览

    0关注

    87博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.0475s