Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to TRIM trailing space in varchar column in oracle

I am using oracle 11g DB and in one of the table having varchar column has data which has trailing spaces. I have tried TRIM function to update the column but still the space at the end of the string prevails. What can be the reason for the trailing space? and how to fix this issue.

Column contents are displayed as below.

select '<'||mycol||'>' from mytab
Output : <mysamplestring >

select DUMP(mycol) from mytab
Output : Typ=1 Len=28: 67,114,117,100,101,32,80,101,116,114,111,108,101,117,109,32,69,120,116,114,97,99,116,105,111,110,194,160

Thanks

like image 707
C.K Avatar asked Aug 31 '25 18:08

C.K


1 Answers

Using UNISTR did the trick for me. It removed the characters 160 and 194

update mytab set mycol = REPLACE(mycol,unistr('\00A0'),'') 
like image 143
C.K Avatar answered Sep 02 '25 06:09

C.K