11_backup_prod.sql 1.0 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=C##DC;
  6. declare
  7. v_count number;
  8. begin
  9. select count(*) into v_count
  10. from all_tables
  11. where owner = 'C##DC'
  12. and table_name = 'PMS_FJYRJC_MP_GRJJ_BAK_20261119';
  13. if v_count = 0 then
  14. execute immediate
  15. 'create table "C##DC".PMS_FJYRJC_MP_GRJJ_BAK_20261119 as '
  16. || 'select * from "C##DC".GRJJ where GRJJMBID = 10563';
  17. end if;
  18. select count(*) into v_count
  19. from all_tables
  20. where owner = 'C##DC'
  21. and table_name = 'PMS_FJYRJC_MP_GW_BAK_20261119';
  22. if v_count = 0 then
  23. execute immediate
  24. 'create table "C##DC".PMS_FJYRJC_MP_GW_BAK_20261119 as '
  25. || 'select * from "C##DC".GW '
  26. || 'where GWID in (1015544, 1015545, 1015546)';
  27. end if;
  28. end;
  29. /
  30. select 'GRJJ' source,count(*) row_count
  31. from PMS_FJYRJC_MP_GRJJ_BAK_20261119
  32. union all
  33. select 'GW',count(*)
  34. from PMS_FJYRJC_MP_GW_BAK_20261119;
  35. exit