ORACLE插入日期数据
oracle数据库插入日期型数据
往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 ......
emctl start dbconsole 是10g的启动console服务的命令
将OEM服务停止emctl stop dbconsole
emctl start dbconsole启动EM console服务,使用前需要先设置ORACLE_SID环境变量
emctl stop dbconsole停止EM console服务,使用前需要先设置ORACLE_SID环境变量
关闭数据库后应该首先用sysdba登陆,这样就进入了sys模式. ......
CREATE OR REPLACE VIEW ADMIN.TYPETREEVIEW
(ID, ITEMNO, ITEMNOSUB, GROUPID, MEMO,
TREE)
AS
/* 2007/01/23 16:51 XieShaoHua 递归查询 */
SELECT typetree.ID, typetree.itemno, typetree.itemnosub, typetree.groupid,
&n ......
select t.*, t.rowid from indicators t start with (t.isleaf='1' and t.rid='26020')
connect by prior t.pid = t.id order by t.inum
从叶子节点依据id=pid的关系向上递归到跟节点。
select t.*, t.rowid from indicators t start with (t.pid='0' and t.rid='26020')
connect by prior t.id = t.pid order by t.i ......