ALERT: Some images may not load properly within the Knowledge Base Article. If you see a broken image, please right-click and select 'Open image in a new tab'. We apologize for this inconvenience.

CA DATACOM SQL RTRIM function not removing trailing blank characters


Article ID: 200165


Updated On:


Datacom DATACOM - AD Datacom/DB


Trying to remove trailing blanks using the RTRIM function but it does not remove the trailing characters.

SELECT RTRIM(field_name) FROM table_name;    



RTRIM only removes blanks (X'40') characters.

Check that the trailing characters are actually blanks and not some other unprintable character.

Run the query using DBSQLPR and the HEXCHAR option. It will display the field in hex. 

In this case it was found the trailing characters are x'00'


Release : 15.1

Component : CA DATACOM SQL


Use the TRIM function to remove characters other than blanks. To remove x'00' trailng characters code:

SELECT TRIM(TRAILING X'00' FROM field_name) FROM table_name;    

Additional Information

See the documentation on Character Functions