oracle 从某字段截取汉字

substr()函数 共三个参数

(目标字符串,开始位置,长度)

instr()函数 共四个参数

(源字符串,目标字符串,开始位置(默认为1,正负数表示往前或往后截取),第几次出现(默认为1))

例如:要求 截取 D表中处理内容字段handle_content 中从第一个经子开始到第一个所字

substr(D.handle_content,     --目标字符串

instr(D.handle_content,'经',1)+1,   --开始位置

instr(D.handle_content,'所',instr(D.handle_content,'经',1)+1,1)  - instr(D.handle_content,'经',1))    -- 长度 (需要计算)

猜你喜欢

转载自blog.csdn.net/godflowers/article/details/82220885