SQL adaptation guide for IBM DB2 UDB 10.x / 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