17,086
社区成员
发帖
与我相关
我的任务
分享
CREATE GLOBAL TEMPORARY table cellBusyHour_temp
(
cell_name varchar2(30),
tch_traffic float
)
ON COMMIT DELETE ROWS;
CREATE GLOBAL TEMPORARY table cellBusyHour_temptwo
(
cell_name varchar2(30),
scan_start_time date
)
ON COMMIT DELETE ROWS;
sql_insert := 'insert into pmdb.t_s_radio_temp1 select * from pmdb.t_s_radio a where a.START_TIME >= :1 and a.START_TIME < :2 ';
execute immediate sql_insert using s_time,e_time;
sql_insert :=' insert into pmdb.cellBusyHour_temp1(cell_name,tch_traffic) select LEVEL_DN , max(tch_traffic) from pmdb.t_s_radio_temp1 group by LEVEL_DN ';
execute immediate sql_insert;
sql_insert := 'insert into pmdb.cellBusyHour_temptwo1(cell_name,scan_start_time) select a.LEVEL_DN ,max(a.start_time) as scan_start_time from
pmdb.t_s_radio_temp1 a , pmdb.cellBusyHour_temp1 b where a.LEVEL_DN=b.cell_name and a.tch_traffic=b.tch_traffic group by a.LEVEL_DN ';
execute immediate sql_insert;
sql_truncate := ' truncate table pmdb.t_s_radio_temp1 ';
execute immediate sql_truncate;
sql_truncate := ' truncate table pmdb.cellBusyHour_temp1 ';
execute immediate sql_truncate;
sql_truncate := ' truncate table pmdb.cellBusyHour_temptwo1 ';
execute immediate sql_truncate;
过程中清除表中数据:
sql_text :='truncate table table_name';
execute immediate sql_text;
不过此用户得有删除任意表的权限,若没有,可以授权:
grant drop any table to 当前用户