INSTR (Lakehouse v1)
Returns the position of the first occurrence of substring substr in string str. This is the same as the two-argument form of LOCATE(), except that the order of the arguments is reversed.
Analyze Syntax
Section titled “Analyze Syntax”func.instr(<str>, <substr>)Analyze Examples
Section titled “Analyze Examples”func.instr('foobarbar', 'bar')┌────────────────────────────────┐│ func.instr('foobarbar', 'bar') │├────────────────────────────────┤│ 4 │└────────────────────────────────┘SQL Syntax
Section titled “SQL Syntax”INSTR(<str>, <substr>)Arguments
Section titled “Arguments”| Arguments | Description |
|---|---|
<str> | The string. |
<substr> | The substring. |
Return Type
Section titled “Return Type”BIGINT
SQL Examples
Section titled “SQL Examples”SELECT INSTR('foobarbar', 'bar');┌───────────────────────────┐│ INSTR('foobarbar', 'bar') │├───────────────────────────┤│ 4 │└───────────────────────────┘
SELECT INSTR('xbar', 'foobar');┌─────────────────────────┐│ INSTR('xbar', 'foobar') │├─────────────────────────┤│ 0 │└─────────────────────────┘