SQL adaptation guide For IBM DB2 UDB 8.x, 9x / Data manipulation |
Informix® provides the LENGTH() function:
SELECT LENGTH("aaa"), LENGTH(col1) FROM table
IBM® DB2® has a equivalent function with the same name, but there is some difference:
You must check if the trailing blanks are significant when using the LENGTH()function.
If you want to count the number of characters by ignoring the trailing blanks, you must use the RTRIM() function:
SELECT LENGTH(RTRIM(col1)) FROM table