Skip to content

Commit

Permalink
Add documentation for octet_length
Browse files Browse the repository at this point in the history
  • Loading branch information
Hespian authored and arushi-firebolt committed Mar 19, 2024
1 parent 0dad586 commit c374e31
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/sql-reference/functions-reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ For more information about using Lambda functions, see [Manipulating arrays with

* [LENGTH](length-string.md)

* [OCTET_LENGTH](octet_length.md)

## Conditional and miscellaneous functions

* [CASE](case.md)
Expand Down
41 changes: 41 additions & 0 deletions docs/sql-reference/functions-reference/octet_length.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
layout: default
title: OCTET_LENGTH
description: Reference material for OCTET_LENGTH function
parent: SQL functions
---

# LENGTH

Calculates the length of the input string in bytes.

## Syntax
{: .no_toc}

```sql
OCTET_LENGTH(<expression>)
```
## Parameters
{: .no_toc}

| Parameter | Description |Supported input types |
| :--------------| :--------------------------------------------|:----------------------|
| `<expression>` | The string or binary data for which to return the length. | `TEXT`, `BYTEA` |

## Return Type
`BIGINT`

## Example
{: .no_toc}

Use the `OCTET_LENGTH` to find the length of any string in bytes, such as:

```sql
SELECT OCTET_LENGTH('🔥')
```

**Returns**: `4`

Because the UTF8 encoding of '🔥' has the byte sequence `0xF0 0x9F 0x94 0xA5`.


0 comments on commit c374e31

Please sign in to comment.