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//