SQLite LENGTH() Function
Definition and Usage
The LENGTH() function returns the number of characters in a text.
For a blob, it returns the number of bytes. For a number, it returns the length of the number written as text. For NULL, it returns NULL.
Tip: Also look at OCTET_LENGTH().
Syntax
LENGTH(text)
Parameter Values
| Parameter | Description |
|---|---|
| text | Required. The text |
Technical Details
| Return type: | Integer |
|---|
More Examples
Example
Return the length of each product name:
SELECT ProductName, LENGTH(ProductName)
FROM Products;
Try it Yourself »