## Syntax ```mermaid %%{init: { 'theme': 'base', 'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' }, 'themeVariables': { 'fontSize': '11px', 'fontFamily': 'Arial' } }}%% flowchart LR Start((START)) --> INSTR[INSTR]:::quoted INSTR --> End((END)) ``` ## Purpose The `INSTR` SQL functions retrieves the position of the first occurrence of a search text in text. Returns `0` when the search text is not present. A positive start position indicates the start position from the left to start from, and search going left to right. A negative start position indicates the start position from the right to start from after removing sign, and search going right to left. Parameters: - Text (`varchar2`): text to be searched for search text. - Search text (`varchar2`): text to search for. - Start position (`int32`, optional): position of character to start searching from. Defaults to `1`. - occurrence (`int32`, optional): return the position of the occurrence. Defaults to `1`. Returns: the position of the search text inside the text as `int32`. ## Examples The following example search for the first occurrence of `o`: ```sql select instr('aap noot mies', 'o') ---------------- 6 ``` The following example search for the second occurrence of `o`: ```sql select instr('aap noot mies', 'o', 1, 2) ---------------- 7 ``` The following example search for the third occurrence of `o` (which does not exist): ```sql select instr('aap noot mies', 'o', 1, 3) ---------------- 0 ```