PowerCenter
- PowerCenter 10.4.0
- All Products
INSTR(string,search_value[,start[,occurrence[,comparison_type]]] )
Argument
| Required/ Optional
| Description
|
---|---|---|
string | Required
| The string must be a character string. Passes the value you want to evaluate. You can enter any valid transformation expression. The results of the expression must be a character string. If not, INSTR converts the value to a string before evaluating it.
|
search_value | Required
| Any value. The search value is case sensitive. The set of characters you want to search for. The search_value must match a part of the string. For example, if you write
INSTR('Alfred Pope', 'Alfred Smith')
the function returns 0.
You can enter any valid transformation expression. If you want to search for a character string, enclose the characters you want to search for in single quotation marks, for example 'abc'.
|
start | Optional
| Must be an integer value. The position in the string where you want to start the search. You can enter any valid transformation expression.
The default is 1, meaning that INSTR starts the search at the first character in the string.
If the start position is 0, INSTR searches from the first character in the string. If the start position is a positive number, INSTR locates the start position by counting from the beginning of the string. If the start position is a negative number, INSTR locates the start position by counting from the end of the string. If you omit this argument, the function uses the default value of 1.
|
occurrence | Optional
| A positive integer greater than 0. You can enter any valid transformation expression. If the search value appears more than once in the string, you can specify which occurrence you want to search for. For example, you would enter 2 to search for the second occurrence from the start position.
If you omit this argument, the function uses the default value of 1, meaning that INSTR searches for the first occurrence of the search value. If you pass a decimal, the
PowerCenter Integration Service rounds it to the nearest integer value. If you pass a negative integer or 0, the session fails.
|
comparison_type | Optional
| The string comparison type, either linguistic or binary, when the
PowerCenter Integration Service runs in Unicode mode. When the
PowerCenter Integration Service runs in ASCII mode, the comparison type is always binary.
Linguistic comparisons take language-specific collation rules into account, while binary comparisons perform bitwise matching. For example, the German sharp s character matches the string “ss” in a linguistic comparison, but not in a binary comparison. Binary comparisons run faster than linguistic comparisons.
Must be an integer value, either 0 or 1:
Default is 0.
If you enter 0, the session sort order must not be binary.
|
INSTR( COMPANY, 'a' )
|
|
---|---|
|
|
|
|
|
|
|
|
|
|
INSTR( COMPANY, 'a', 1, 2 )
|
|
---|---|
|
|
|
|
|
|
|
|
|
|
INSTR( COMPANY, 'a', -1, 2 )
|
|
---|---|
|
|
|
|
|
|
|
|
|
|
INSTR( COMPANY, 'Blue Fin Aqua Center', -1, 1 )
|
|
---|---|
|
|
|
|
|
|
|
|
|
|
SUBSTR( CUST_NAME,1,INSTR( CUST_NAME,' ' ,-1,1 ))
|
|
---|---|
|
|
|
|
SUBSTR( CUST_ID, 1, INSTR(CUST_ID, '#')-1 ) || SUBSTR( CUST_ID, INSTR(CUST_ID, '#')+1 )
|
|
---|---|
|
|
|
|
|
|