Steven5007

导航

oracle常用函数_时间

https://blog.csdn.net/qq_39720920/article/details/85274428

https://blog.csdn.net/qq_37768482/article/details/78148034

https://blog.csdn.net/hustzw07/article/details/51426935

1.时间比较

 and createDate >= to_date('2019-03-11','yyyy-mm-dd HH24:mi:ss')
 and createDate <= to_date('2019-03-13','yyyy-mm-dd HH24:mi:ss')+1

 2.ORACLE中date和timestamp的相互转化

 cast(taskfinishtime As Date) as taskfinishtime2,
 to_char(taskfinishtime,'yyyy-mm-dd hh24:mi:ss') as taskfinishtime3,

相关链接: https://blog.csdn.net/huangbaokang/article/details/80733411

3.Oralce 将时间差转换为  天:时:分:秒

学习链接: https://blog.csdn.net/yzy85/article/details/80566651

SELECT 
   (EXTRACT(DAY FROM (to_date('2012-03-30 23:23:15','YYYY-MM-DD HH24:MI:ss')-to_date('2012-03-29 00:23:00','YYYY-MM-DD HH24:MI:ss')) DAY TO SECOND )
   || '天'
   ||EXTRACT(HOUR FROM (to_date('2012-03-30 23:23:15','YYYY-MM-DD HH24:MI:ss')-to_date('2012-03-29 00:23:00','YYYY-MM-DD HH24:MI:ss')) DAY TO SECOND )
   || '时'
   || EXTRACT(MINUTE FROM (to_date('2012-03-30 23:23:15','YYYY-MM-DD HH24:MI:ss')-to_date('2012-03-29 00:23:00','YYYY-MM-DD HH24:MI:ss')) DAY TO SECOND )
   || '分'
   || EXTRACT(SECOND FROM (to_date('2012-03-30 23:23:15','YYYY-MM-DD HH24:MI:ss')-to_date('2012-03-29 00:23:00','YYYY-MM-DD HH24:MI:ss')) DAY TO SECOND )
   || '秒')  as timespan
FROM DUAL;

时间戳:

to_date(TO_CHAR(p.finishtime, 'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss')-to_date(TO_CHAR(p.createtime, 'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss')

4. Oracle中的instr()函数 详解及应用

学习: https://www.cnblogs.com/dshore123/p/7813230.html

instr(org.TOTALCODE, '0001,1000,2010,0008,0113') > 0

5.Oracle 行转列 动态出转换的列

学习: https://blog.csdn.net/Huay_Li/article/details/82924443

 

 

posted on 2019-07-15 11:52  Steven5007  阅读(191)  评论(0编辑  收藏  举报