char和varchar2对比

-- Create table
create table TLCB_HARDWARE_INFO
(
  sdate                  DATE,
  ip                     CHAR(20),
  operating_system       VARCHAR2(30),
  operatingsystemrelease CHAR(10),
  hostname               VARCHAR2(40),
  memory_total           CHAR(10),
  swap_total             CHAR(10),
  manufacturer           VARCHAR2(30)
)

-- Create table
create table TLCB_MON_DEVICE
(
  devicename   VARCHAR2(200),
  devicetype   VARCHAR2(200),
  ipaddr       VARCHAR2(200),
  encodetype   VARCHAR2(200),
  descp        VARCHAR2(200),
  sysnameshort VARCHAR2(200),
  dept         VARCHAR2(200),
  hasdeployed  VARCHAR2(200) default 0,
  dpmode       VARCHAR2(30)
)

select b.descp,a.* from  tlcb_hardware_info a,tlcb_mon_device b
where trim(a.ip)=b.ipaddr

SQL> select ipaddr,dump(ipaddr) from tlcb_mon_device b where b.ipaddr='10.16.83.2'
  2  ;
 
IPADDR                                                                           DUMP(IPADDR)
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
10.16.83.2                                                                       Typ=1 Len=10: 49,48,46,49,54,46,56,51,46,50
 
SQL> select ip,dump(ip) from tlcb_hardware_info b where b.ip='10.16.83.2';
 
IP                   DUMP(IP)
-------------------- --------------------------------------------------------------------------------
10.16.83.2           Typ=96 Len=20: 49,48,46,49,54,46,56,51,46,50,32,32,32,32,32,32,32,32,32,32

chr(32) 空格符


SQL> select ip,dump(ip) from tlcb_cron a where a.ip='10.2.231.1';
 
IP                   DUMP(IP)
-------------------- --------------------------------------------------------------------------------
10.2.231.1           Typ=96 Len=20: 49,48,46,50,46,50,51,49,46,49,32,32,32,32,32,32,32,32,32,32
 
 
SQL> select  ipaddr,dump(ipaddr) from tlcb_mon_device a where a.ipaddr='10.2.231.1';
 
IPADDR                                                                           DUMP(IPADDR)
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
10.2.231.1                                                                       Typ=1 Len=10: 49,48,46,50,46,50,51,49,46,49
 


发布了3871 篇原创文章 · 获赞 119 · 访问量 359万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览