oracle mybatis 从字符串里去除某个字符,返回新的字符串

<!-- 子节点完成 修改父节点表中信息 -->
<update id="updateOrganizationZzkc" parameterType="map">
UPDATE T_CADRE_ORGANIZATION_ZZKC
<set>
UPDATE_BY = #{UPDATE_BY}
,UPDATE_DATE = #{UPDATE_DATE}
,PRESERVE04 = SUBSTR( replace(concat( '-',PRESERVE04),#{NODEREPLACEFLAG}, '-'), INSTR(replace(concat( '-',PRESERVE04),#{NODEREPLACEFLAG}, '-'),'-') + 1, length(replace(concat( '-',PRESERVE04),#{NODEREPLACEFLAG}, '-')) )
</set>
WHERE NUM_ID = #{ZZKC_ID}
</update>

 

=======参数类型是(-加字符加-的形式)=============================

bean.put("NODEREPLACEFLAG", "-2-");

=========sql运行效果=============================

SELECT
z.NUM_ID,z.PRESERVE03,
replace(concat( '-',PRESERVE03),'-5-', '-') as h,
INSTR(replace(concat( '-',PRESERVE03),'-5-', '-'),'-') as ll,
length(replace(concat( '-',PRESERVE03),'-5-', '-')) as hh,

 

SUBSTR( replace(concat( '-',PRESERVE03),'-5-', '-'), INSTR(replace(concat( '-',PRESERVE03),'-5-', '-'),'-') + 1, length(replace(concat( '-',PRESERVE03),'-5-', '-')) ) as fdsk

 

FROM
T_CADRE_ORGANIZATION_ZZKC z
WHERE NUM_ID = '0041BD26D0A94675BB64832DF3EC7E2A'

 

posted @ 2018-12-11 18:04  程序员小明1024  阅读(2209)  评论(0编辑  收藏  举报