17,377
社区成员
发帖
与我相关
我的任务
分享
--1.假设你的数据库中,日期的存储为8位的年月日:
20110101
20111112
...
--sql
select * from tableName where date = to_char(sysdate, 'yyyyMMdd')
--2.假设你的数据库中,日期存储为带有时分秒的timestamp型,而你想抽出年月日相同的日期,不计较时分秒
20110101142330
...
--sql
select * from tableNmae where substr(date,0,8) = to_char(sysdate, 'yyyyMMdd')
select * from tablename where date like substr(to_char(sysdate,'yyyy-mm-dd'),0,10)||'%'
select * from tablename where instr(to_char(sysdate,'yymmdd'),date)>0
select * from tablename where instr(to_char(sysdate,'yymmdd'),date)>0