-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0dad586
commit c374e31
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`. | ||
|
||
|