select d.id, d.item, d.productcategory, d.en_name, d.cn_name, d.cas_no, d.dept_id, d.del_flag, d.hazard_phrases, d.cmr, d.remarks, d.creater_code, d.ghs_pictogram, d.createdate, d.holdup, d.updater_code, d.work_area, d.form, d.updatedate, d.explosion_limit, d.melting_point, d.boiling_point, d.density, d.purity, d.responsible_company, d.issue_time, d.version, d.reviewer, d.reviewdate, d.review_state, d.next_reviewdate, d.issuetime_two, d.issuetime_three ,s.dept_name from t_msds d left join sys_dept s on s.dept_id = d.dept_id SELECT seq_t_msds.NEXTVAL as id FROM DUAL insert into t_msds id, item, productcategory, en_name, cn_name, cas_no, dept_id, del_flag, hazard_phrases, remarks, cmr, ghs_pictogram, creater_code, holdup, createdate, updater_code, work_area, updatedate, form, explosion_limit, melting_point, boiling_point, density, purity, responsible_company, issue_time, issuetime_two, issuetime_three, version, reviewer, reviewdate, review_state, next_reviewdate, #{id}, #{item}, #{productcategory}, #{enName}, #{cnName}, #{casNo}, #{deptId}, #{delFlag}, #{hazardPhrases}, #{remarks}, #{cmr}, #{ghsPictogram}, #{createrCode}, #{holdup}, #{createdate}, #{updaterCode}, #{workArea}, #{updatedate}, #{form}, #{explosionLimit}, #{meltingPoint}, #{boilingPoint}, #{density}, #{purity}, #{responsibleCompany}, #{issueTime}, #{issuetimeTwo}, #{issuetimeThree}, #{version}, #{reviewer}, #{reviewdate}, #{reviewState}, #{nextReviewdate}, update t_msds item = #{item}, productcategory = #{productcategory}, en_name = #{enName}, cn_name = #{cnName}, cas_no = #{casNo}, dept_id = #{deptId}, del_flag = #{delFlag}, hazard_phrases = #{hazardPhrases}, remarks = #{remarks}, cmr = #{cmr}, ghs_pictogram = #{ghsPictogram}, creater_code = #{createrCode}, holdup = #{holdup}, createdate = #{createdate}, updater_code = #{updaterCode}, work_area = #{workArea}, updatedate = #{updatedate}, form = #{form}, explosion_limit = #{explosionLimit}, melting_point = #{meltingPoint}, boiling_point = #{boilingPoint}, density = #{density}, purity = #{purity}, responsible_company = #{responsibleCompany}, issue_time = #{issueTime}, issuetime_two = #{issuetimeTwo}, issuetime_three = #{issuetimeThree}, issue_time = null, issuetime_two = null, issuetime_three = null, version = #{version}, reviewer = #{reviewer}, reviewdate = #{reviewdate}, review_state = #{reviewState}, next_reviewdate = #{nextReviewdate}, where id = #{id} update t_msds set del_flag = 2 where id = #{id} update t_msds set del_flag = 2 where id in #{id}