PowerCenter
- PowerCenter 10.5
- All Products
SUBSTR(string,start[,length] )
Argument
| Required/
Optional
| Description
|
---|---|---|
string
| Required
| Must be a character string. Passes the strings you want to search. You can enter any valid transformation expression. If you pass a numeric value, the function converts it to a character string.
|
start
| Required
| Must be an integer. The position in the string where you want to start counting. You can enter any valid transformation expression. If the start position is a positive number, SUBSTR locates the start position by counting from the beginning of the string. If the start position is a negative number, SUBSTR locates the start position by counting from the end of the string. If the start position is 0, SUBSTR searches from the first character in the string.
|
length
| Optional
| Must be an integer greater than 0. The number of characters you want SUBSTR to return. You can enter any valid transformation expression. If you omit the length argument, SUBSTR returns all of the characters from the start position to the end of the string. If you pass a negative integer or 0, the function returns an empty string. If you pass a decimal, the function rounds it to the nearest integer value.
|
SUBSTR( PHONE, 0, 3 )
|
|
---|---|
|
|
|
|
|
|
SUBSTR( PHONE, 1, 3 )
|
|
---|---|
|
|
|
|
|
|
SUBSTR( PHONE, 5, 8 )
|
|
---|---|
|
|
|
|
|
|
|
|
SUBSTR( PHONE, -8, 3 )
|
|
---|---|
|
|
|
|
|
|
|
|
SUBSTR( CUST_NAME,1,INSTR( CUST_NAME,' ' ,-1,1 ) - 1 )
|
|
---|---|
|
|
|
|
SUBSTR( CUST_ID, 1, INSTR(CUST_ID, '#')-1 ) || SUBSTR( CUST_ID, INSTR(CUST_ID, '#')+1 )
SUBSTR('abcd', 2, 8)
SUBSTR('abcd', -2, 8)