-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
--	Name 		: ckpopalg.sql.sql
--	Description	: This script populates the jr_id_maps database table
--			  with GUID values for all rows in the CK_APPLICATION_LOGIC table
--
--	Date		: 30th November 1998
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

DECLARE

BEGIN

  update ck_migration_objects set ci_created = 'N' where ci_stage = 'CKPOPALG';

  dbms_output.enable(1000000);

-- **************************************************************************
--
--				CK_APPLICATION_LOGIC
--
-- **************************************************************************

  dbms_output.put_line('* Inserting ck_application_logic');

 
 -- UPG_APPLICATION_LOGIC
  INSERT INTO jr_id_maps ( trans_ref               
                         , old_id                 
                         , irid                  
                         , ivid                   
                         , element_type 
                         , occur_type                   
                         , is_a_pac_element      
                         , owning_app              
                         , owning_app_id           
                         , type_id       
                         , part_of_id                             
                         , use_of_id               
                         , pop_tab )     
                  SELECT   0
                         , a.AL_ID
                         , jr_util.get_new_irid
                         , jr_system_util.get_new_ivid
                         , 'APPLOG'
                         , NULL
                         , NULL
                         , NULL
                         , NULL
                         , NULL
                         , a.AL_REPOS_ELEMENT
                         , NULL
                         , 'CK_APPLICATION_LOGIC'
                    FROM   UPG_APPLICATION_LOGIC   a;


    update ck_migration_objects set ci_created = 'Y' where ci_stage = 'CKPOPALG';

    COMMIT;

EXCEPTION 
   when others then
   dbms_output.put_line (' ** Exception Raised ** ');
   dbms_output.put_line ('...ERROR: '||substrb(sqlerrm, 1, 200));
   raise;
END;
/


