ORACLE 中如何将日期中年月日截取到年月

ORACLE 中如何将日期中年月日截取到年月,第1张

1、创建测试表,create table test_date(v_date date);

2、插入测试数据,

insert into test_date

select sysdate - level 10 from dual connect by level < 100

3、查询表中所有记录,select from test_date,可以看到时间格式为年月日时分秒,

4、编写sql,将时间截取到年月,

select t,

     to_char(v_date, 'yyyymm') v_date_mon1,

     trunc(v_date, 'mm') v_date_mon2

from TEST_DATE t

select  from tabname

 where to_date(creatime,'yyyy-mm-dd hh24:mi:ss') < to_date('2014-09-12','yyyy-mm-dd')

以上就是关于ORACLE 中如何将日期中年月日截取到年月全部的内容,包括:ORACLE 中如何将日期中年月日截取到年月、Oracle 提取时间日期。varchar2、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/9545398.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-29
下一篇 2023-04-29

发表评论

登录后才能评论

评论列表(0条)

保存