syntax:less
SUBSTR (string, start_position, [length_of_substring])
eg:code
substr('This is a test', 6, 2) would return 'is'
remarks:rem
- 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.
syntax:string
instr(string,substring,[position],[occurrence])
eg:it
select instr('corporate floor','or',3,2) from dual; would return '14'
remarks:io
- The default values of both position and occurrence are 1, meaning Oracle begins searching at the first character of string for the first occurrence of substring.
- The return value is relative to the beginning of string, regardless of the value of position.
CASE UPPER(T1.COLUMN_TYPE) WHEN SUBSTR(RF1.PARAM_VALUE,1,INSTR(RF1.PARAM_VALUE,'~')-1) THEN SUBSTR(RF1.PARAM_VALUE,INSTR(RF1.PARAM_VALUE,'~')+1) ELSE T1.PRODUCT_TYPE_DESC END AS PRODUCT_TYPE
COLUMN_TYPE: AN APPLE
PARAM_VALUE: AN APPLE~FRUIT
SUBSTR(RF1.PARAM_VALUE,1,INSTR(RF1.PARAM_VALUE,'~')-1): AN APPLE
INSTR(RF1.PARAM_VALUE,'~')+1: 10
這裏用於字段參數化,從一個參數表的某個相應字段中對比取值,對比~前的值,若是一致,那麼取~後的值。test