ORCLE SUBSTR、instr、regexp_substr字段拆分

update  YW_JL_MS_OLD_APPA_INFO A
  set (A.FACTORY_NUM,A.MAKE_ENT_NAME)=
  (select 
    SUBSTR(MAKE_ENT_NAME,instr(MAKE_ENT_NAME,regexp_substr(MAKE_ENT_NAME,'[0-9a-fA-F]+'))) as make_num,
    SUBSTR(MAKE_ENT_NAME,1,instr(MAKE_ENT_NAME,SUBSTR(MAKE_ENT_NAME,instr(MAKE_ENT_NAME,regexp_substr(MAKE_ENT_NAME,'[0-9a-fA-F]+'))))-1) as MAKE_NAME
    from YW_JL_MS_OLD_APPA_INFO B
    where regexp_substr(MAKE_ENT_NAME,'[0-9a-fA-F]+') is not null

  and A.ID=B.ID)

通过正则把一个字段拆分为两个字段,前提是两个字段中其中一个为中文,另外一个为英文或数字组成

猜你喜欢

转载自blog.csdn.net/IOSWEB/article/details/80922648