oracle 数据类型

char

固定长度,最长2000,会使用空格将值填充到指定的长度。优点,查询快。

varchar2
1、最大长度4000字节或4000字符
2、变长,末尾不添加无意义的空格
3、如果试图在 varchar2 字段中插入超过其规定范围的字符,出错
示例:insert into emp(empno, ename) values(13, '一高级工程师');
列 "SCOTT"."EMP"."ENAME" 的值太大 (实际值: 12, 最大值: 10)

LOB大字段类型,9i 版本中可保存 4GB 数据, 在 10g 版本中可保存多达 128TB
BLOB是按二进制来存储的,可以存储图片、文件和音乐等,先将文件转为二进制再存储进去。
CLOB是直接存储文字的,CLOB可以存储文章或较长文字的内容

number
可以是整数,也可以是小数

binary_float
binary_double

date
1、精确到秒
2、默认插入格式:'9-8月-1999'
示例:insert into emp(empno, hiredate) values(33, '9-9月-1999');
(1)alter session set nls_date_format = 'yyyy/mm/dd';
insert into emp(empno, hiredate) values(44, '1999/9/9');
(2)to_date('1999-9-9', 'yyyy-mm-dd');
insert into emp(empno, hiredate) values(55, to_date('1999-9-9', 'yyyy-mm-dd'));

timestamp 精确到秒的小数部分

drop table test;
drop table test1;
create table test(id timestamp(6));
insert into test values(systimestamp);
insert into test values(systimestamp);
select * from test;
13-7月 -18 07.31.45.572000 下午
13-7月 -18 07.32.31.136000 下午

create table test1(id timestamp(9));
insert into test1 values(systimestamp);
select * from test1;
13-7月 -18 07.42.30.996000000 下午
insert into test1 values (to_timestamp('2006-01-01 12:10:10.1','yyyy-mm-dd hh24:mi:ss.ff'));
select * from test1;
13-7月 -18 07.33.33.048000000 下午

timestamp with time zone 数据类型存储时区信息

原文地址:https://www.cnblogs.com/Mike_Chang/p/9306782.html