I'm trying to remove trailing spaces without success:
select trim(trailing ' ' from '1234 '), '56' from sysibm.sysdummy1;
1 2
--------------------------- --
1234 56
What am I missing?
It is documented that trim will leave the data type as is - check out the Knowledge Center
describe "select trim( '1234 '), '56' from sysibm.sysdummy1"
Column Information
Number of columns: 2
SQL type Type length Column name Name length
-------------------- ----------- ------------------------------ -----------
448 VARCHAR 27 1 1
448 VARCHAR 2 2 1
If you want to change the look / data type of the result you can cast it to the length or data type you need
select varchar(trim( '1234 '), 5), '56' from sysibm.sysdummy1"
1 2
----- --
1234 56
1 record(s) selected.