| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- set define off
- set echo on
- whenever sqlerror exit sql.sqlcode
- alter session set container=ORCLPDB;
- alter session set current_schema=C##DC;
- declare
- v_count number;
- begin
- select count(*) into v_count from all_tables
- where owner='C##DC' and table_name='PMS_FJYRJC_CSSG1_GRJJ_BAK_20261119';
- if v_count = 0 then
- execute immediate 'create table "C##DC".PMS_FJYRJC_CSSG1_GRJJ_BAK_20261119 as '
- || 'select * from "C##DC".GRJJ where YYRYID=111157142';
- end if;
- select count(*) into v_count from all_tables
- where owner='C##DC' and table_name='PMS_FJYRJC_CSSG1_GRJJ_TEMPLATE_BAK_20261119';
- if v_count = 0 then
- execute immediate 'create table "C##DC".PMS_FJYRJC_CSSG1_GRJJ_TEMPLATE_BAK_20261119 as '
- || 'select * from "C##DC".GRJJ where GRJJMBID=10523';
- end if;
- select count(*) into v_count from all_tables
- where owner='C##DC' and table_name='PMS_FJYRJC_CSSG1_QZ_BAK_20261119';
- if v_count = 0 then
- execute immediate 'create table "C##DC".PMS_FJYRJC_CSSG1_QZ_BAK_20261119 as '
- || 'select * from "C##DC".QZ where YYRYID=111157142 or MC=''cssg1-风纪仪容检查授权''';
- end if;
- select count(*) into v_count from all_tables
- where owner='C##DC' and table_name='PMS_FJYRJC_CSSG1_QZCY_BAK_20261119';
- if v_count = 0 then
- execute immediate 'create table "C##DC".PMS_FJYRJC_CSSG1_QZCY_BAK_20261119 as '
- || 'select qc.* from "C##DC".QZCY qc join "C##DC".QZ q on q.QZID=qc.QZID '
- || 'where q.YYRYID=111157142 or q.MC=''cssg1-风纪仪容检查授权''';
- end if;
- select count(*) into v_count from all_tables
- where owner='C##DC' and table_name='PMS_FJYRJC_CSSG1_CREATED_20261119';
- if v_count = 0 then
- execute immediate 'create table "C##DC".PMS_FJYRJC_CSSG1_CREATED_20261119 '
- || '(GRJJID number, QZID number, QZCYID number, CREATED_AT timestamp)';
- end if;
- end;
- /
- select 'GRJJ_PERSONAL' source,count(*) row_count from PMS_FJYRJC_CSSG1_GRJJ_BAK_20261119
- union all
- select 'GRJJ_TEMPLATE',count(*) from PMS_FJYRJC_CSSG1_GRJJ_TEMPLATE_BAK_20261119
- union all
- select 'QZ',count(*) from PMS_FJYRJC_CSSG1_QZ_BAK_20261119
- union all
- select 'QZCY',count(*) from PMS_FJYRJC_CSSG1_QZCY_BAK_20261119;
- exit
|