过程 oracle 写在哪里,Oracle怎么写存储过程? 在什么地方写以及怎么调用?最好给个Sample 急(2)...
當前位置:我的異常網? Java Web開發???Oracle怎么寫存儲過程? 在什么地方寫以及怎么調用
Oracle怎么寫存儲過程? 在什么地方寫以及怎么調用?最好給個Sample 急(2)
www.myexceptions.net??網友分享于:2013-03-27??瀏覽:244次
select sum(times_m) into vcalledtimes_min from (select servicename,ceil(to_char((to_date(endtime, 'yyyy-mm-dd hh24:mi:ss ')-to_date(begintime, 'yyyy-mm-dd hh24:mi:ss '))*24*60-0.25)) as times_m,round(to_char((to_date(endtime, 'yyyy-mm-dd hh24:mi:ss ')-to_date(begintime, 'yyyy-mm-dd hh24:mi:ss '))*24*60*60),0) as times_s from origcdr where (callingnumber like '13% ' or callingnumber like '15% ') and callednumber like '10176% ' and substr(begintime,1,10) > = vbegintime and substr(begintime,1,10) <= vendtime) where times_s> 15 and servicename=vservicename;
-----人均使用時長-----
select sum(times) into vcalledtimes_sec_tem from (select round(to_char((to_date(endtime, 'yyyy-mm-dd hh24:mi:ss ')-to_date(begintime, 'yyyy-mm-dd hh24:mi:ss '))*24*60*60),0) as times from origcdr where (callingnumber like '13% ' or callingnumber like '15% ') and callednumber like '10176% ' and substr(begintime,1,10) > = vbegintime and substr(begintime,1,10) <= vendtime and servicename=vservicename);
vcalledtimes_avg := round(vcalledtimes_sec_tem/vcallednum_peo,2);
-----人均撥打次數-----
vcalledcount_avg := round(vcalledcount/vcallednum_peo,2);
-----預計信息費------
select servicecost into vservicecost from servicetype where servicename=vservicename;
vcalledcost := round(vservicecost*vcalledtimes_min,1);
end if;
insert into called_temp (servicename,calledcount,callednum_peo,callednum_peo_15,calledtimes_sec,calledtimes_min,calledtimes_avg,calledcount_avg,calledcost)
values(vservicename,vcalledcount,vcallednum_peo,vcallednum_peo_15,vcalledtimes_sec,vcalledtimes_min,vcalledtimes_avg,vcalledcount_avg,vcalledcost);
dbms_output.put_line(vservicename);
dbms_output.put_line(vcalledcount);
dbms_output.put_line(vcallednum_peo);
dbms_output.put_line(vcallednum_peo_15);
dbms_output.put_line(vcalledtimes_sec);
dbms_output.put_line(vcalledtimes_min);
dbms_output.put_line(vcalledtimes_avg);
dbms_output.put_line(vcalledcount_avg);
dbms_output.put_line(vcalledcost);
fetch curservericetype into ee;
end loop;
close curservericetype;
end;
文章評論
《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀總結
以上是生活随笔為你收集整理的过程 oracle 写在哪里,Oracle怎么写存储过程? 在什么地方写以及怎么调用?最好给个Sample 急(2)...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: oracle怎么关闭约束,Oracle约
- 下一篇: oracle 按日输出 取整数,Orac