--Reconstructed Projections
--Code Fragment 9.9
SELECT PROJECTION_ID, PROJECTION_NAME, PROJECTION_TYPE, SPHEROID_CODE,
       PROJECTION_UOM, ZONE_CODE 
FROM P_Audit A 
WHERE NOT EXISTS (SELECT * FROM P_Audit A2 
                  WHERE A.PROJECTION_ID = A2.PROJECTION_ID AND 
                        TO_DATE('04/01/1996','MM/DD/YYYY') < A2.When_Changed AND  
                        A2.When_Changed < A.When_Changed) 
      AND TO_DATE('04/01/1996','MM/DD/YYYY') < A.When_Changed
      AND EXISTS (SELECT * FROM P_AUDIT A3 
                  WHERE A.PROJECTION_ID = A3.PROJECTION_ID AND 
                  A3.When_Changed <= TO_DATE('04/01/1996','MM/DD/YYYY') )
UNION 
SELECT * FROM PROJECTIONS P 
WHERE TO_DATE('04/01/1996','MM/DD/YYYY') > 
        (SELECT MAX(When_Changed) FROM P_Audit A WHERE P.PROJECTION_ID = A.PROJECTION_ID);




