ORACLE插入日期数据
oracle数据库插入日期型数据
往Oracle数据库中插入日期型数据(to_date的用法)
今天碰到了需要往Oracle数据库中插入日期型数据,要使用TO_DATE函数,在网上发现一篇写的不错的文章,摘来一起分享。
INSERT INTO FLOOR VALUES ( to_date ( '2007-12-20 18:31:34' , 'YYYY-MM-DD HH24:MI:SS' ) ) ;
查询显示:2007-12-20 18:31:34.0
-------------------
INSERT INTO FLOOR VALUES ( to_date ( '2007-12-14 14:10' , 'YYYY-MM-DD HH24:MI' ) );
查询显示:2007-12-14 14:10:00.0
-------------------
INSERT INTO FLOOR VALUES ( to_date ( '2007-12-14 14' , 'YYYY-MM-DD HH24' ) );
查询显示:2007-12-14 14:00:00.0
-------------------
INSERT INTO FLOOR VALUES ( to_date ( '2007-11-15' , 'YYYY-MM-DD' ) );
查询显示:2007-11-15 00:00:00.0
-------------------
INSERT INTO FLOOR VALUES ( to_date ( '2007-09' , 'YYYY-MM' ) );
查询显示:2007-09-01 00:00:00.0
-------------------
INSERT INTO FLOOR VALUES ( to_date ( '2007' , 'YYYY' ) );
查询显示:2007-05-01 00:00:00.0
-------------------
当省略HH、MI和SS对应的输入参数时,Oracle使用0作为DEFAULT值。
如果输入的日期数据忽略时间部分,Oracle会将时、分、秒部分都置为0,也就是说会取整到日。
同样,忽略了DD参数,Oracle会采用1作为日的默认值,也就是说会取整到月。
但是,不要被这种“惯性”所迷惑,如果忽略MM参数,Oracle并不会取整到年,而是取整到当前月
相关文档:
oracle表空间操作详解
1
2
3作者: 来源: 更新日期:2006-01-04
5
6
7建立表空间
8
9CREATE TABLESPACE data01
10DATAFILE '/ora ......
一、ORACLE的启动和关闭
1、在单机环境下要想启动或关闭ORACLE系统必须首先切换到ORACLE用户,如下
su - oracle
a、启动ORACLE系统
oracle>svrmgrl
SVRMGR>connect internal
SVRMGR>startup
SVRMGR>quit
b、关闭ORACLE系统
oracle>svrmgrl
SVRMGR>connect internal
SVRMGR>shutdow ......
建表
create table <table_name>(
column_name1 column_type [not null] [check (expression)]
[default value] [primary key][references <table_name>(column_name)],
column_name2 column_type [not null] [check (expression)]
[default value] [prima ......
Parsing command line arguments:
Parameter "silent" = true
java.lang.ArrayIndexOutOfBoundsException: 2
at oracle.net.ca.CmdlineArgs.parseArgs(Unknown Source)
at oracle.net.ca.I ......
分类:Oracle
一.引言
ORACLE数据库字符集,即Oracle全球化支持(Globalization Support),或即国家语言支持(NLS)其作用是用本国语言和格式来存储、处理和检索数据。利用全球化支持,ORACLE为用户提供自己熟悉的数据库母语环境,诸如日期格式、数字格式和存储序列等。Oracle可以支持 ......