-- -------------------------------------------------------------
-- loadCHECKnew_lc.sql:
-- This SQL script is to check the content of the loading layer
--   here: table LOCATION: no double bounding boxes
--   It is called from SQL script loadCHECK.sql.
--                                                ft, 1999.07.20
-- -------------------------------------------------------------
-- 1: no dubles in min/max_lat/lon
-- -------------------------------------------------------------
insert into LOAD_ERROR_MESSAGES select 
       28, 0, 'none', 'NEW_LOCATION', 'WARDUB', 'at location_id = '||location_id||': erroneous (?) double bounding box found'
  from  NEW_LOCATION nl
 where  min_lat is not NULL   and max_lat is not NULL
   and  min_lon is not NULL   and max_lon is not NULL
   and  (min_lat, max_lat, min_lon, max_lon)     in 
        (select min_lat, max_lat, min_lon, max_lon from LOCATION UNION
         select min_lat, max_lat, min_lon, max_lon from NEW_LOCATION
          where nl.location_id <> NEW_LOCATION.location_id);
-- The END of loadCHECKnew_lc.sql
