-- -------------------------------------------------------------
-- loadCHECKload_lcx.sql:
-- This SQL script is to check the content of the loading layer
--   here: the LOAD_* LOV character fields, extended version,
--   (same functionality as loadCHECKload_lch.sql, just 4 parameters:
--         LOAD_* table, column, CERA Core table, column).
--   It is called from SQL script loadCHECK.sql.
--                                                ft, 1999.07.20
-- -------------------------------------------------------------
-- 1: no NULLS allowed, in LOAD_&1.&2
-- -------------------------------------------------------------
insert into LOAD_ERROR_MESSAGES select 
       8, L.entry_id, LOAD_ENTRY.entry_acronym, 'LOAD_&1', 'WARNUL', '&2 = NULL is not smart'
  from  LOAD_&1 L, LOAD_ENTRY where L.&2 is NULL and L.entry_id is not NULL
   and  L.entry_id = LOAD_ENTRY.entry_id;
-- -------------------------------------------------------------
-- 2: item should be in the LOV or in NEW_&3.&4
-- -------------------------------------------------------------
insert into LOAD_ERROR_MESSAGES select distinct 
       9, LOAD_ENTRY.entry_id, LOAD_ENTRY.entry_acronym, 'LOAD_&1' ,'FATILL','&2='||&2||' not in table CERA.&3 nor in NEW_&3'
  from  LOAD_&1, LOAD_ENTRY
 where  &2 not IN (select &4 from     &3)
   and  &2 not IN (select &4 from NEW_&3)
   and  LOAD_&1..entry_id = LOAD_ENTRY.entry_id;
-- The end of loadCHECKload_lcx.sql
