1. substr()
SUBSTR (string,start_position,[length_of_substring])
eg:
substr('This is a test',6,2) would return 'is'
remarks:
- The original string is assumed to start at position one (1).
- If substring_length is omitted,then Oracle returns all characters to the end of char.
- If substring_length is less than 1,then Oracle returns null.
2. instr()
instr(string,substring,[position],[occurrence])
eg:
select instr('corporate floor','or',3,2) from dual; would return '14'
remarks:
我的用例:
CASE UPPER(T1.COLUMN_TYPE) WHEN SUBSTR(RF1.ParaM_VALUE,1,INSTR(RF1.ParaM_VALUE,'~')-1) THEN SUBSTR(RF1.ParaM_VALUE,'~')+1) ELSE T1.PRODUCT_TYPE_DESC END AS PRODUCT_TYPE
COLUMN_TYPE: AN APPLE ParaM_VALUE: AN APPLE~FRUITSUBSTR(RF1.ParaM_VALUE,'~')-1): AN APPLE INSTR(RF1.ParaM_VALUE,'~')+1: 10这里用于字段参数化,从一个参数表的某个相应字段中对比取值,对比~前的值,如果一致,那么取~后的值。
原文地址:https://www.jb51.cc/oracle/205955.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。