New versions: Dev (3.15) | Latest (3.14) | 3.13 | 3.12 | 3.11 | 3.10 | 3.9 | 3.8 | Old versions: 3.7 | 3.6 | 3.5 | 3.4 | 3.3
LENGTH
Applies to ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
The LENGTH()
function calculates the length of a given string.
SELECT length('hello');
create.select(length("hello")).fetch();
The result being
+--------+ | length | +--------+ | 5 | +--------+
Dialect support
This example using jOOQ:
length("hello")
Translates to the following dialect specific expressions:
-- ACCESS, SQLDATAWAREHOUSE, SQLSERVER len('hello') -- ASE, AURORA_MYSQL, AURORA_POSTGRES, BIGQUERY, COCKROACHDB, CUBRID, EXASOL, FIREBIRD, H2, HSQLDB, IGNITE, INFORMIX, MARIADB, -- MEMSQL, MYSQL, POSTGRES, REDSHIFT, VERTICA char_length('hello') -- DB2, DERBY, HANA, INGRES, ORACLE, SNOWFLAKE, SQLITE, SYBASE, TERADATA length('hello')
(These are currently generated with jOOQ 3.15, see #10141)
Feedback
Do you have any feedback about this page? We'd love to hear it!