[Home] [Help]
583: -- load_checkfile_info
584: --
585: -- Purpose
586: -- Imports file information from ad_check_file_temp to ad_files,
587: -- ad_file_versions, and ad_check_files.
588: --
589: -- Only creates rows in ad_files and ad_file_versions that don't
590: -- already exist. In ad_check_files, it creates rows that don't already
591: -- exist and also updates existing rows if the version to load is higher
586: -- Imports file information from ad_check_file_temp to ad_files,
587: -- ad_file_versions, and ad_check_files.
588: --
589: -- Only creates rows in ad_files and ad_file_versions that don't
590: -- already exist. In ad_check_files, it creates rows that don't already
591: -- exist and also updates existing rows if the version to load is higher
592: -- than the current version in ad_check_files.
593: --
594: -- Processes all rows in ad_check_file_temp with active_flag='Y'.
588: --
589: -- Only creates rows in ad_files and ad_file_versions that don't
590: -- already exist. In ad_check_files, it creates rows that don't already
591: -- exist and also updates existing rows if the version to load is higher
592: -- than the current version in ad_check_files.
593: --
594: -- Processes all rows in ad_check_file_temp with active_flag='Y'.
595: --
596: -- To handle batch sizes:
607: --
608: -- Calls load_file_version_info
609: --
610: -- Updates the check_file_id column of ad_check_file_temp so that any
611: -- rows that were already in ad_check_files point to the check_file_id
612: -- of the (file, distinguisher) referenced in the row. Rows in
613: -- ad_check_file_temp that did not already have corresponding rows in
614: -- ad_check_files still have null values for check_file_id
615: -- (assuming they started out as null)
610: -- Updates the check_file_id column of ad_check_file_temp so that any
611: -- rows that were already in ad_check_files point to the check_file_id
612: -- of the (file, distinguisher) referenced in the row. Rows in
613: -- ad_check_file_temp that did not already have corresponding rows in
614: -- ad_check_files still have null values for check_file_id
615: -- (assuming they started out as null)
616: --
617: -- Arguments
618: -- none
632: ad_file_util.error_buf||sqlerrm||')';
633: raise;
634: end;
635: --
636: -- process ad_check_files
637: --
638:
639: --
640: -- get check_file_id and manifest_vers_higher
642: ad_file_util.error_buf := 'load_checkfile_info('||
643: 'update ad_check_file_temp t '||
644: 'set t.check_file_id = '||
645: '(select cf.check_file_id '||
646: 'from ad_check_files cf '||
647: 'where cf.file_id = t.file_id '||
648: 'and nvl(cf.distinguisher,''*null*'') ='||
649: ' nvl(t.distinguisher,''*null*'')), '||
650: 't.manifest_vers_higher =.....);):(';
651:
652: begin
653: update ad_check_file_temp t
654: set t.check_file_id =
655: (select /*+ INDEX(CF AD_CHECK_FILES_U2) */ cf.check_file_id
656: from ad_check_files cf
657: where cf.file_id = t.file_id
658: and nvl(cf.distinguisher,'*null*') = nvl(t.distinguisher,'*null*')),
659: t.manifest_vers_higher =
652: begin
653: update ad_check_file_temp t
654: set t.check_file_id =
655: (select /*+ INDEX(CF AD_CHECK_FILES_U2) */ cf.check_file_id
656: from ad_check_files cf
657: where cf.file_id = t.file_id
658: and nvl(cf.distinguisher,'*null*') = nvl(t.distinguisher,'*null*')),
659: t.manifest_vers_higher =
660: (select /*+ ORDERED INDEX(FV1 AD_FILE_VERSIONS_U1)
657: where cf.file_id = t.file_id
658: and nvl(cf.distinguisher,'*null*') = nvl(t.distinguisher,'*null*')),
659: t.manifest_vers_higher =
660: (select /*+ ORDERED INDEX(FV1 AD_FILE_VERSIONS_U1)
661: INDEX(CF AD_CHECK_FILES_U2) INDEX(FV2 AD_FILE_VERSIONS_U1)
662: USE_NL(FV1 CF FV2) */
663: decode(
664: sign(nvl(fv1.version_segment1,0) - nvl(fv2.version_segment1,0)),
665: -1, null, 1, 'Y', decode(
682: sign(nvl(fv1.version_segment10,0) - nvl(fv2.version_segment10,0)),
683: -1, null, 1, 'Y', decode(
684: sign(fv1.translation_level - fv2.translation_level),
685: -1, null, 1, 'Y', null)))))))))))
686: from ad_file_versions fv1, ad_check_files cf, ad_file_versions fv2
687: where t.file_version_id = fv1.file_version_id
688: and t.file_id = cf.file_id
689: and nvl(t.distinguisher,'*null*') = nvl(cf.distinguisher,'*null*')
690: and cf.file_version_id = fv2.file_version_id)
694: ad_file_util.error_buf := ad_file_util.error_buf||sqlerrm||')';
695: raise;
696: end;
697: --
698: -- add new entries into ad_check_files
699: --
700: ad_file_util.error_buf := 'load_checkfile_info('||
701: 'insert into ad_check_files '||
702: '(check_file_id, file_id, distinguisher, '||
697: --
698: -- add new entries into ad_check_files
699: --
700: ad_file_util.error_buf := 'load_checkfile_info('||
701: 'insert into ad_check_files '||
702: '(check_file_id, file_id, distinguisher, '||
703: 'file_version_id, creation_date) '||
704: 'select ad_check_files_s.nextval, '||
705: 'temp.f_id, temp.dist, temp.fv_id, '||
700: ad_file_util.error_buf := 'load_checkfile_info('||
701: 'insert into ad_check_files '||
702: '(check_file_id, file_id, distinguisher, '||
703: 'file_version_id, creation_date) '||
704: 'select ad_check_files_s.nextval, '||
705: 'temp.f_id, temp.dist, temp.fv_id, '||
706: 'temp.edate from (select distinct '||
707: 't.file_id f_id, t.distinguisher dist, '||
708: 't.file_version_id fv_id, '||
711: 'is null and nvl(t.active_flag,''N'') = '||
712: '''Y'') temp;):(';
713:
714: begin
715: insert into ad_check_files
716: (check_file_id, file_id, distinguisher,
717: file_version_id, creation_date)
718: select ad_check_files_s.nextval,
719: temp.f_id, temp.dist, temp.fv_id, temp.edate
714: begin
715: insert into ad_check_files
716: (check_file_id, file_id, distinguisher,
717: file_version_id, creation_date)
718: select ad_check_files_s.nextval,
719: temp.f_id, temp.dist, temp.fv_id, temp.edate
720: from
721: (select distinct
722: t.file_id f_id,
732: raise;
733: end;
734: --
735: --
736: -- delete from ad_check_files where versions lower than manifest
737: --
738: ad_file_util.error_buf := 'load_checkfile_info('||
739: 'delete from ad_check_files kf '||
740: 'where cf.check_file_id in '||
735: --
736: -- delete from ad_check_files where versions lower than manifest
737: --
738: ad_file_util.error_buf := 'load_checkfile_info('||
739: 'delete from ad_check_files kf '||
740: 'where cf.check_file_id in '||
741: '(select t.check_file_id '||
742: 'from ad_check_file_temp t '||
743: 'where t.manifest_vers_higher = ''Y'' '||
743: 'where t.manifest_vers_higher = ''Y'' '||
744: 'and nvl(t.active_flag,''N'') = ''Y'');):(';
745:
746: begin
747: delete /*+ INDEX(CF AD_CHECK_FILES_U1) */ from ad_check_files cf
748: where cf.check_file_id in
749: (select t.check_file_id
750: from ad_check_file_temp t
751: where t.manifest_vers_higher = 'Y'
755: ad_file_util.error_buf := ad_file_util.error_buf||sqlerrm||')';
756: raise;
757: end;
758: --
759: -- insert into ad_check_files where versions lower than manifest
760: --
761: ad_file_util.error_buf := 'load_checkfile_info('||
762: ' insert into ad_check_files '||
763: '(check_file_id, file_id, distinguisher, '||
758: --
759: -- insert into ad_check_files where versions lower than manifest
760: --
761: ad_file_util.error_buf := 'load_checkfile_info('||
762: ' insert into ad_check_files '||
763: '(check_file_id, file_id, distinguisher, '||
764: 'file_version_id, creation_date) '||
765: 'select temp.cf_id, '||
766: 'temp.f_id, temp.dist, temp.fv_id, temp.edate '||
774: 'where t.manifest_vers_higher = ''Y'' '||
775: 'and nvl(t.active_flag,''N'') = ''Y'') temp;):(';
776:
777: begin
778: insert into ad_check_files
779: (check_file_id, file_id, distinguisher,
780: file_version_id, creation_date)
781: select temp.cf_id,
782: temp.f_id, temp.dist, temp.fv_id, temp.edate
796: raise;
797: end;
798:
799: --
800: -- done processing ad_check_files
801: --
802:
803: end load_checkfile_info;
804: