LENGTH

Returns the length of a value.

This function corresponds to the length(X) function in SQLite. The behavior depends on the data type of the column:

  • For a string value, it returns the number of characters (not bytes) in the string.

  • For a BLOB value, it returns the number of bytes in the blob. This is an alias for OCTET_LENGTH.

  • For a numeric value, it returns the length of its string representation.

  • For a NULL value, the result is NULL.

Example

// For a string column: SELECT length(name) FROM Users
// For a blob column: SELECT length(data) FROM Files
val nameLength = select(LENGTH(Users.name)).from(Users).execute().getLong(0)

Return

A KQLiteColumn of type Long containing the length of the value.

Author

MOHAMMAD AZIM ANSARI

Parameters

column

The column whose length is to be calculated.

See also