问题描述
- 求 oracle大神啊 ~~~~~~~~~~~~ create time 加7天如何写
-
select c.* from crm_order_taobao_opt_history c where c.CREATE_TIME<'当前时间sysdate' and '当前时间sysdate'<'CREATE_TIME加上7天的时间' and c.order_sn like 'TB%' and c.opt_status=12 and not exists (select 1 from crm_order_taobao_opt_history o where c.order_sn=o.order_Sn and o.opt_status=13 ) and ( exists(select 1 from crm_tb_apply_refund_record o where o.order_sn=c.order_sn and o.audit_Result =126080 ) or not exists(select 1 from crm_tb_apply_refund_record o where o.order_sn=c.order_sn ) or exists(select 1 from crm_tb_apply_refund_record o where o.order_sn=c.order_sn and o.audit_Result =126062 and o.last_operate_time is not null and o.last_operate_time<1438162149 and o.cancel_result=40035 and nvl(o.repeat_Count,0)<11) )
解决方案
使用to_date日期转换,varchar转date,然后在+7
select to_date('2004-05-07 13:23:44','yyyy-mm-dd hh24:mi:ss') + 7 from dual//
解决方案二:
REATE_TIME加上7天的时间
to_char(to_date(REATE_TIME,'yyyy-MM-dd hh24:mi:ss')+7,'yyyy-MM-dd')
解决方案三:
如果是时间类型,直接 createtime+7就行了
解决方案四:
字段是varchar类型的,如何加呢?
时间: 2024-10-02 23:42:45