REM This script flags objects to be reloaded for 4_6 Upgrade

DECLARE

BEGIN


-- THE FOLLOWING PATCHES HAVE BEEN ROLLED IN
-- PATCH  NAME      OBJECT_TYPES  FILENAME      OBJECT_NAME
-- ====== ========= ============= ============= ===================
-- 001    LOLDHAM   TABLE         jrdpnd.jpb    SDD_DPND_DAR_RESULT 
--                  CONSTRAINT                  SDD_DPND_DAR_CHK_USAGE
--                  CONSTRAINT                  SDD_DPND_DAR_CHK_CONTEXT
--                  PACKAGE       jrname.jps    JR_NAME
--                  PACKAGE BODY *jrname.jpb    JR_NAME
--                  PACKAGE BODY  jrdpnd.jpb    JR_DEPENDENCY
-- 
-- 002    STLYON    PACKAGE BODY  cidom.hpb     CIHDOM
--                  PACKAGE BODY  ciatt.hpb     CIHATT
--                  PACKAGE BODY  ckupddom.hpb  CKOUPDDOMAIN
--                               
-- 003    PMEHTA    PACKAGE BODY  jrrule.jpb    JR_RULE
--  
-- 004    STLYON    PACKAGE BODY  ciplm.opb     CIOPLSQL_MODULE 
-- 
-- 006    PMETHA    PACKAGE BODY  jrwaste.jpb   JR_WASTEBASKET
-- 
-- 007    DLGOLDSM  PACKAGE BODY  jrchkref.jpb  JR_CHECK_REFS 
-- 
-- 008    LOLDHAM   PACKAGE BODY *jrname.jpb    JR_NAME
--
-- 009    PATCH VERSION NUMBER + ROB



-- UPDATES THE OBJECTS IN THE FOLLOWING STAGES
-- CKPACCOM -- already done
-- JRPACK   -- already done

  -- UPDATE FOR TABLE
  UPDATE CK_INSTALLED_OBJECTS
  SET    CI_CREATED = 'R'
  WHERE  CI_TYPE    = 'TABLE'
  AND    CI_NAME    = 'SDD_DPND_DAR_RESULT';


  -- UPDATE FOR CONSTRAINTS
  UPDATE CK_INSTALLED_OBJECTS
  SET    CI_CREATED = 'R'
  WHERE  CI_TYPE    = 'CONSTRAINT'
  AND    CI_NAME    IN ( 'SDD_DPND_DAR_CHK_USAGE'
  		       , 'SDD_DPND_DAR_CHK_CONTEXT');
  
  -- UPDATE FOR PACKAGE SPECS
  UPDATE CK_INSTALLED_OBJECTS
  SET    CI_CREATED = 'R'
  WHERE  CI_TYPE    = 'PACKAGE'
  AND    CI_NAME    = 'JR_NAME';



  -- UPDATE FOR PACKAGE BODIES
  UPDATE CK_INSTALLED_OBJECTS
  SET    CI_CREATED = 'R'
  WHERE  CI_TYPE    = 'PACKAGE BODY'
  AND    CI_NAME IN  ('JR_NAME'  
                     ,'JR_DEPENDENCY'
                     ,'CIHDOM'
                     ,'CIHATT'
                     ,'CKOUPDDOMAIN'
                     ,'JR_RULE'
                     ,'CIOPLSQL_MODULE'  
                     ,'JR_WASTEBASKET'
                     ,'JR_CHECK_REFS'); 

  
  
  -- Update for ROB Objects 
  UPDATE CK_INSTALLED_OBJECTS
  SET    CI_CREATED = 'R'
  WHERE  CI_STAGE LIKE 'CKROB%';

  -- Update for verify of stage
  UPDATE CK_INSTALLED_OBJECTS
  SET    CI_CREATED = 'Y'
  WHERE  CI_STAGE   = 'CKUPD4_6';

  COMMIT;



EXCEPTION

  WHEN OTHERS THEN
    dbms_output.put_line('* Exception Raised  ');
    dbms_output.put_line('...ERROR: '||substrb(sqlerrm,1,240));
    rollback work;
    RAISE;

END;
/
