SQL programming / SQL portability |
The semantics of the LENGTH() SQL function differs according to the database engine.
Database Server Type | Function name | Counting unit | Significant trailing blanks for CHAR() columns | Return value when NULL |
---|---|---|---|---|
Genero db |
LENGTH(expr) |
Octets | No | NULL |
IBM® DB2® UDB |
LENGTH(expr) |
Octets | Yes | NULL |
IBM Informix® (1) |
LENGTH(expr) |
Octets | No | NULL |
Microsoft™ SQL Server (2) |
LEN(expr) |
Characters | No | NULL |
MySQL |
LENGTH(expr) |
Characters | No | NULL |
Oracle Database Server |
LENGTH(expr) |
Characters | Yes | NULL |
PostgreSQL |
LENGTH(expr) |
Characters | Yes | NULL |
Sybase ASE (2) |
LEN(expr) |
Characters | No | NULL |
SQLite |
LENGTH(expr) |
Characters | Yes | NULL |
Search for LENGTH() usage in your SQL statements and review the code of the database-specific function.