• char类型关联


    SQL> create table a1(id int,name char(10));
    
    Table created.
    
    SQL> create table a2(id int,name char(10));
    
    Table created.
    
    SQL> insert into a1 values(1,'a');
    
    1 row created.
    
    SQL> commit;
    
    Commit complete.
    
    SQL> insert into a2 values(100,'a'||CHR(13));
    
    1 row created.
    
    
    
    SQL> select dump(name) from a1;
    
    DUMP(NAME)
    --------------------------------------------------------------------------------
    Typ=96 Len=10: 97,32,32,32,32,32,32,32,32,32
    
    
    
    SQL> select length(name) from a1;
    
    LENGTH(NAME)
    ------------
    	  10
    
    
    SQL> select dump(name) from a2;
    
    DUMP(NAME)
    --------------------------------------------------------------------------------
    Typ=96 Len=10: 97,13,32,32,32,32,32,32,32,32
    
    SQL> select length(name) from a2;
    
    LENGTH(NAME)
    ------------
    	  10
    
    
    SQL> select * from a1,a2
      2  where a1.name=a2.name;
    
    no rows selected
    
    SQL> select * from a1,a2
      2  where a1.name=replace(a2.name,CHR(13),'');
    
    no rows selected
    
    看来char 用这种方式是没法替换回车符的,原因:
    SQL> select length(replace(a2.name,CHR(13),'')) from a2;
    LENGTH(REPLACE(A2.NAME,CHR(13),''))
    -----------------------------------
          9
    变成9位了,当然和a1.name 10位关联不上
    SQL> select * from a1,a2 2 where a1.name=replace(a2.name,CHR(13),CHR(32)); ID NAME ID NAME---------- ---------- ---------- ---------- 1 a 100 aSQL> select * from a1,a2 2 where a1.name=replace(a2.name,CHR(13),''||' ');ID NAME ID NAME---------- ---------- ---------- ---------- 1 a 100 a需要在补上一个空格
    


     

  • 相关阅读:
    大教堂和市集
    VB相关资源
    什么样的团队才是优秀的团队
    走过2007
    一种简单实用的错误码构建方法
    熊的困惑
    调测中的反思
    PowerPC852T的SMC初始化—串口通信
    Silverlight Listbox 取消全选的方法
    电脑读不出U盘,有一个黄色感叹号的解决方法
  • 原文地址:https://www.cnblogs.com/zhaoyangjian724/p/3797967.html
Copyright © 2020-2023  润新知