drop command in Procedure

EXEC pkg_dwh_common_proc.stpr_dwh_drop_tbl('tbl_maprg_pp_usr_main_tmp', 'N');

create table  tbl_maprg_pp_usr_main_tmp 
tablespace &5
as
select * from tbl_maprg_pp_vst_usr_maint_u where 1=2 ;

variable month_cnt   number;

BEGIN

  select count(*) INTO :month_cnt
  from tbl_maprg_pp_vst_usr_maint_u
  where month>to_char(add_months(to_date('&4','yyyymmdd'),-24),'yyyymm')
    and month<to_char(add_months(to_date('&4','yyyymmdd'),+1),'yyyymm')
    and aprov_flg='Y';

  IF :month_cnt!=24 THEN
 
  execute immediate 'drop table tbl_maprg_pp_usr_main_tmp ';
 
  Dbms_Output.put_line('Please check the user maintenance table!');
 
  ELSE 
    Dbms_Output.put_line('OK!');
  END IF;
 
  execute immediate 'select * from tbl_maprg_pp_usr_main_tmp' ;  
  execute immediate 'drop table tbl_maprg_pp_usr_main_tmp ';
 
END;
/

你可能感兴趣的:(procedure)