This query runs and returns no rows.
SELECT DISTINCT TO_CHAR(START_DATE,'MM/DD/YYYY'),                             
                TO_CHAR(END_DATE,  'MM/DD/YYYY')                              
FROM                                                                          
(                                   
    SELECT START_DATE, END_DATE, END_DATE - START_DATE
    FROM
    (
        SELECT TO_DATE(SUBSTR(B,  1, 10), 'MM/DD/YYYY') START_DATE,               
               TO_DATE(SUBSTR(B, 14, 10), 'MM/DD/YYYY') END_DATE                  
        FROM (SELECT 'test date' b from dual)
    )
    WHERE END_DATE - START_DATE != 6
)
This small piece fails to run, due to the conversion error. [1]: ORA-01858: a non-numeric character was found where a numeric was expected
SELECT TO_DATE(SUBSTR(B,  1, 10), 'MM/DD/YYYY') START_DATE,               
       TO_DATE(SUBSTR(B, 14, 10), 'MM/DD/YYYY') END_DATE                  
FROM (SELECT 'test date' b from dual)
My expectation here was that the conversion error would cause an Oracle exception causing the program to fail out. There is something I don't know, or am not thinking about correctly.
Can someone point my nose in the correct direction on this one?
Thanks. Evil.
EDIT - NULL is handled differently with to_date. Oracle: Avoiding NULL value in to_date
EDIT - Plan
3 SELECT STATEMENT  ALL_ROWS
Cost: 3  Bytes: 0  Cardinality: 1  
Partition #: 0          
    2 FILTER  
    Cost: 0  Bytes: 0  Cardinality: 0  
    Partition #: 0      
        1 FAST DUAL  
        Cost: 2  Bytes: 0  Cardinality: 1  
        Partition #: 0 
EDIT - I am running 10g.
 
     
    