zoukankan      html  css  js  c++  java
  • 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需要在补上一个空格
    


     

  • 相关阅读:
    小程序实现无限瀑布流
    Vue H5 项目模板
    Taro使用mobx做国际化小程序
    一次国际化记录以及平铺JSON数据
    Promise(interesting)
    返回状态码
    CSS属性兼容写法
    在DOM加载之前insertScript
    关于吸烟
    前端优化措施
  • 原文地址:https://www.cnblogs.com/zhaoyangjian724/p/3797967.html
Copyright © 2011-2022 走看看