我的表有一個字段是Varchar2(20)類型, 現在我發現有一些記錄是很怪異,比如記錄命名只有10個字符,
但是我用length()函數返回它的長度竟然是16,我開始懷疑後面有空格字符,我用replace()函數把空格去掉了,
可是長度還是16.我用下面得語句做的測試.真不知道這條記錄中是什麽東西在裏面.
1,去空格返回長度,發現以下select length(itm_code),length(replace(itm_code,' ','')) From tblitemmaster where itm_code like'2012500001-2%'---------------
16                       162 用字符a替換空格,發現沒有替換select itm_code,replace(itm_code,' ','a') From tblitemmaster where itm_code like'2012500001-2%'
---------------------------------------------------------------
2012500001-2 2012500001-2 請各位給些提示.

解决方案 »

  1.   

    select length(rtrim(itm_code)) from tblitemmaster where itm_code like'2012500001-2%';
    --试试
      

  2.   

    不行,我試過了.select length(itm_code),length(rtrim(itm_code)) From tblitemmaster where itm_code like'2012500001-2%'----------------------------------------------
    16                             16
      

  3.   

    select ascii(substr(itm_code,13,1)) from tblitemmaster where itm_code like'2012500001-2%';
    --查查asc码