---
title: "LENGTH"
description: "The LENGTH SQL function gets for a varchar2 the number of characters in provided text and for a blob the number of bytes in provided BLOB."
language: en
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/sql-functions/length
original: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/sql-functions/length
updated: 2026-08-09T00:00:00Z
license: https://documentation.invantive.eu/en/
---

## Syntax
```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> LENGTH[LENGTH]:::quoted
    LENGTH --> End((END))
```

## Purpose
The `LENGTH` SQL function gets for a `varchar2` the number of characters in provided text and for a `blob` the number of bytes in provided BLOB.

Parameters:
- Input (`blob` or `varchar2`): the value to process.

Returns: the length of the input as an `int32`.

## Examples
The following example retrieves the number of characters in a text:
```sql
select length('abcdefg')

----------------
7
```
The following example retrieves the number of bytes in a `blob`:
```sql
select length(random_blob(512))

----------------
512
```