REM This script flags objects to be reloaded for MR4 Upgrade 

DECLARE 

BEGIN 

-- UPDATES THE OBJECTS IN THE FOLLOWING STAGES

-- JRPACK   -- already done
-- CKPACCOM -- already done
-- CKPACK   -- already done
-- CKVIEW   -- NEW FOR MR4
-- JRVIEW   -- already done
-- CKTABS   -- already done
	
	-- UPDATE for PACKAGES
	UPDATE CK_INSTALLED_OBJECTS 		
	SET CI_CREATED = 'R'		
	WHERE  CI_TYPE = 'PACKAGE'		
	AND    CI_NAME IN ( 'JR_ACC_RIGHTS'
                    , 'JR_NAME'
                    , 'JR_RM_INS'
                    , 'CIIEXP' 
                    , 'CIOCOLUMN'
                    , 'CIODOMAIN'
                    , 'CIOORACLE_COLLECTION_TYPE'
                    , 'CIIUTL' 
                    , 'CIOCLUSTER_COLUMN'
                    , 'JR_RULE_PROCS');

	-- UPDATE for PACKAGE BODIES
	UPDATE CK_INSTALLED_OBJECTS 		
	SET    CI_CREATED = 'R'		
	WHERE  CI_TYPE    = 'PACKAGE BODY'		
	AND    CI_NAME IN ( 'CIHDOM'	
                    , 'CIHCOL'	 
                    , 'JR_ACC_RIGHTS'
                    , 'JR_NAME'
                    , 'JR_RM_INS'
                    , 'CIIEXP'	
                    , 'CIHENT'
                    , 'CK_FDTREE'
                    , 'JR_COPY'
                    , 'RMMAC'
                    , 'CICOL1' 
                    , 'CIOORACLE_DATABASE'
                    , 'CDAPI'
                    , 'CIOCOLUMN'
                    , 'CIODOMAIN'
                    , 'CIOORACLE_COLLECTION_TYPE'
                    , 'CIIUTL' 
                    , 'CIOCLUSTER_COLUMN'
                    , 'JR_RULE_PROCS' );  
                                     
	
  -- UPDATE for VIEWS
	UPDATE CK_INSTALLED_OBJECTS 		
	SET    CI_CREATED = 'R'		
	WHERE  CI_TYPE    = 'VIEW'		
	AND    CI_NAME IN ( 'CI_ROOT_CONTAINER_ELEMENTS' 
                    , 'CI_ROOT_APPLICATION_SYSTEMS'
                    , 'CI_CONTAINER_ELEMENTS' 
                    , 'SDD_LOST_AND_FOUND' );  
                    
  -- UPDATE for TABLE
	UPDATE CK_INSTALLED_OBJECTS 		
	SET    CI_CREATED = 'R'		
	WHERE  CI_TYPE    = 'TABLE'		
	AND    CI_NAME IN ( 'CK_TEMP_IRIDS' );   
	
	-- Update for verify of stage
	UPDATE CK_INSTALLED_OBJECTS 
	SET    CI_CREATED = 'Y'
	WHERE  CI_STAGE   = 'CKUPDMR4';
	
	COMMIT;
	
EXCEPTION

  WHEN OTHERS THEN 

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

END;
/
