01_backup_test.sql 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. set define off
  2. set echo on
  3. whenever sqlerror exit sql.sqlcode
  4. alter session set container=ORCLPDB;
  5. alter session set current_schema=PMS_TEST;
  6. declare
  7. v_count number;
  8. begin
  9. select count(*) into v_count from all_tables
  10. where owner='PMS_TEST' and table_name='PMS_FJYRJC_CSSG1_GRJJ_BAK_20261119';
  11. if v_count = 0 then
  12. execute immediate 'create table PMS_FJYRJC_CSSG1_GRJJ_BAK_20261119 as '
  13. || 'select * from GRJJ where YYRYID = 111157142';
  14. end if;
  15. select count(*) into v_count from all_tables
  16. where owner='PMS_TEST' and table_name='PMS_FJYRJC_CSSG1_QZ_BAK_20261119';
  17. if v_count = 0 then
  18. execute immediate 'create table PMS_FJYRJC_CSSG1_QZ_BAK_20261119 as '
  19. || 'select * from QZ where QZID = 5001141';
  20. end if;
  21. select count(*) into v_count from all_tables
  22. where owner='PMS_TEST' and table_name='PMS_FJYRJC_CSSG1_QZCY_BAK_20261119';
  23. if v_count = 0 then
  24. execute immediate 'create table PMS_FJYRJC_CSSG1_QZCY_BAK_20261119 as '
  25. || 'select * from QZCY where QZID = 5001141';
  26. end if;
  27. select count(*) into v_count from all_tables
  28. where owner='PMS_TEST' and table_name='PMS_FJYRJC_CSSG1_CREATED_20261119';
  29. if v_count = 0 then
  30. execute immediate 'create table PMS_FJYRJC_CSSG1_CREATED_20261119 '
  31. || '(GRJJID number, QZID number, QZCYID number, CREATED_AT timestamp)';
  32. end if;
  33. end;
  34. /
  35. select 'GRJJ' source,count(*) row_count from PMS_FJYRJC_CSSG1_GRJJ_BAK_20261119
  36. union all
  37. select 'QZ',count(*) from PMS_FJYRJC_CSSG1_QZ_BAK_20261119
  38. union all
  39. select 'QZCY',count(*) from PMS_FJYRJC_CSSG1_QZCY_BAK_20261119;
  40. exit