--运行出错 select * from ( select DM,DMMC,to_date(JKM,'YYYY.MM.DD') AS SSSQ_Q,to_date(BCM,'YYYY.MM.DD') AS SSSQ_Z From TNCS01 where DMLB='NSSBBD' and dm in (select SBLX_DM from TNSB01 where NSRDZDAH=500105000001247173 and ((to_date('2008.06.01','YYYY.MM.DD') Between YXQ_Q and YXQ_Z) or YXQ_Z is null)) ) A where to_date('2008.06.01','YYYY.MM.DD') Between SSSQ_Q AND SSSQ_Z
--运行正常 select * from ( select DM,DMMC,to_date(JKM,'YYYY.MM.DD') as SSSQ_Q, to_date(BCM,'YYYY.MM.DD') as SSSQ_Z from TNCS01 where DMLB='NSSBBD' and dm in (select SBLX_DM from TNSB01 where NSRDZDAH=500105000001247173 and ((to_date('2008.06.01','YYYY.MM.DD') Between YXQ_Q and YXQ_Z) or YXQ_Z is null)) ) AAA where to_date('2008.06.01','YYYY.MM.DD') Between to_date('2008.06.01','YYYY.MM.DD') AND to_date('2008.06.30','YYYY.MM.DD')
------解决方案-------------------- ORA-01841的意思是你给出的日期值不对,日期值必须在:January 1, 4712 B.C. and December 31, 9999 A.D.之间。 所以需要修改你给出的值,并且需要给出date类型的值。 例子如下: SELECT * FROM v$session s WHERE s.LOGON_TIME BETWEEN &START AND &END;