IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    检查字段中不可见字符

    小荷发表于 2015-09-12 00:27:07
    love 0

    在一个mysql导入到oracle的库中,某字段显示为’a',但是用where column=’a’ 返回0行,只有where column like ‘a%’ 才有返回结果。那么,在该字段的末尾,应该是有些不可见字符了。我们可以用dump字段来检查。

    dump的用法,大致如下:

    DUMP(<字段名>,参数值),其中,具体的参数值的含义,可以见下表。
    Value    Explanation
    ------ ------------------
    8    octal notation
    10    decimal notation
    16    hexadecimal notation
    17    single characters
    1008    octal notation with the character set name
    1010    decimal notation with the character set name
    1016    hexadecimal notation with the character set name
    1017    single characters with the character set name

    如:

    DUMP('Tech')
    Result: 'Typ=96 Len=4: 84,101,99,104'
     
    DUMP('Tech', 10)
    Result: 'Typ=96 Len=4: 84,101,99,104'
     
    DUMP('Tech', 16)
    Result: 'Typ=96 Len=4: 54,65,63,68'
     
    DUMP('Tech', 1016)
    Result: 'Typ=96 Len=4 CharacterSet=US7ASCII: 54,65,63,68'
     
    DUMP('Tech', 1017)
    Result: 'Typ=96 Len=4 CharacterSet=US7ASCII: T,e,c,h'

    经检查后,发现末尾有个ascii 0,也就是null。



沪ICP备19023445号-2号
友情链接