【发布时间】:2020-09-15 02:15:05
【问题描述】:
我想获取参数中传入的月份的第一天和最后一天。
我尝试使用以下查询,但出错了。
select LAST_DAY(to_date(to_char(('01'||:P_MONTH||'2020'),'DDMMYYYY'),'YYYYMM'))
FROM DUAL
我想在查询中使用它
select * from
GL_CODE_TAB
where effective_start_date = LAST_DAY(to_date(to_char(('01'||:P_MONTH||'2020'),'DDMMYYYY'),'YYYYMMDD'))
并在表格 GL_CODE_TAB 中搜索我过去一个月的第一天/最后一天,例如如果我通过“五月”
select * from
GL_CODE_TAB
where effective_start_date = LAST_DAY(to_date(to_char(('01'||'May'||'2020'),'DDMMYYYY'),'YYYYMMDD'))
应该像这样进行搜索
select * from
GL_CODE_TAB
where effective_start_date = '20200531'
【问题讨论】:
-
请提供样本数据和期望的结果。
-
嗨,我已经编辑了我的问题
标签: sql oracle date oracle-sqldeveloper where-clause