01_backup.sql 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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
  10. from all_tables
  11. where owner = 'PMS_TEST'
  12. and table_name = 'PMS_FJYRJC_MP_GRJJ_BAK_20261119';
  13. if v_count = 0 then
  14. execute immediate
  15. 'create table PMS_TEST.PMS_FJYRJC_MP_GRJJ_BAK_20261119 as '
  16. || 'select * from PMS_TEST.GRJJ where GRJJMBID = 10543';
  17. end if;
  18. select count(*) into v_count
  19. from all_tables
  20. where owner = 'PMS_TEST'
  21. and table_name = 'PMS_FJYRJC_MP_GW_BAK_20261119';
  22. if v_count = 0 then
  23. execute immediate
  24. 'create table PMS_TEST.PMS_FJYRJC_MP_GW_BAK_20261119 as '
  25. || 'select * from PMS_TEST.GW '
  26. || 'where GWID in (1015564, 1015565, 1015566)';
  27. end if;
  28. end;
  29. /
  30. select 'GRJJ' source,count(*) row_count
  31. from PMS_TEST.PMS_FJYRJC_MP_GRJJ_BAK_20261119
  32. union all
  33. select 'GW',count(*)
  34. from PMS_TEST.PMS_FJYRJC_MP_GW_BAK_20261119;
  35. exit