create or replace procedure p_Dial as insert into 结算统计表 select caller, to_char(starttime,'YYYY-MM'), count(*), sum(endtime-starttime) from 每日话单统计 group by caller,to_char(starttime,'YYYY-MM')
楼上已有正解了 所以也没有必要在回复了 但是不明白的是你的呼叫次数是怎么计算出来的 如果按照一分钟记一次的话就应该用这样 insert into 结算统计表 select caller, to_char(starttime,'YYYY-MM'), to_number((enddate-starttime)*24*60), sum(endtime-starttime) from 每日话单统计 group by caller,to_char(starttime,'YYYY-MM')
但是不明白的是你的呼叫次数是怎么计算出来的
如果按照一分钟记一次的话就应该用这样
insert into 结算统计表
select caller,
to_char(starttime,'YYYY-MM'),
to_number((enddate-starttime)*24*60),
sum(endtime-starttime)
from 每日话单统计
group by caller,to_char(starttime,'YYYY-MM')