> ## Documentation Index
> Fetch the complete documentation index at: https://docs.firebolt.io/llms.txt
> Use this file to discover all available pages before exploring further.

> Reference material for POSITION function

# POSITION

Returns the position of the substring found in the string, starting from 1. The returned value is for the first matching value, and not for any subsequent valid matches.
In case the substring does not exist, functions will return 0.

## Syntax

```sql theme={"theme":{"light":"css-variables","dark":"css-variables"}}
POSITION(<substring> IN <string>)
```

## Parameters

| Parameter     | Description                       | Supported input types |
| :------------ | :-------------------------------- | :-------------------- |
| `<substring>` | The substring to search for.      | `TEXT`                |
| `<string>`    | The string that will be searched. | `TEXT`                |

## Return Type

`INTEGER`

## Examples

<div className="query-window">
  ```
  SELECT POSITION('hello' IN 'hello world') AS res;
  ```

  | res <span>int</span> |
  | :------------------- |
  | 1                    |

  <p><span>Rows: 1</span><span>Execution time: 5.73ms</span></p>
</div>

<div className="query-window">
  ```
  SELECT POSITION('world' IN 'hello world') AS res;
  ```

  | res <span>int</span> |
  | :------------------- |
  | 7                    |

  <p><span>Rows: 1</span><span>Execution time: 5.34ms</span></p>
</div>

<div className="query-window">
  ```
  SELECT POSITION('work' IN 'hello world') AS res;
  ```

  | res <span>int</span> |
  | :------------------- |
  | 0                    |

  <p><span>Rows: 1</span><span>Execution time: 4.65ms</span></p>
</div>
