读书人

sqlplus 执行20个存储过程 为什么执行

发布时间: 2012-03-21 13:33:15 作者: rapoo

sqlplus 执行20个存储过程 为什么执行最后一个要耗用很长时间

SQL code
declare         Import_Date date;begin        Import_date:=to_date('2011-04-01','YYYY-MM-DD');        sp_GetOCNResult_XH(Import_Date);        commit;end;/declare         Import_Date date;begin        Import_date:=to_date('2011-05-01','YYYY-MM-DD');        sp_GetOCNResult_XH(Import_Date);        commit;end;/declare         Import_Date date;begin        Import_date:=to_date('2011-06-01','YYYY-MM-DD');        sp_GetOCNResult_XH(Import_Date);        commit;end;/declare         Import_Date date;begin        Import_date:=to_date('2011-07-01','YYYY-MM-DD');        sp_GetOCNResult_XH(Import_Date);        commit;end;/declare         Import_Date date;begin        Import_date:=to_date('2011-08-01','YYYY-MM-DD');        sp_GetOCNResult_XH(Import_Date);        commit;end;/declare         Import_Date date;begin        Import_date:=to_date('2011-09-01','YYYY-MM-DD');        sp_GetOCNResult_XH(Import_Date);        commit;end;/declare         Import_Date date;begin        Import_date:=to_date('2011-10-01','YYYY-MM-DD');        sp_GetOCNResult_XH(Import_Date);        commit;end;/declare         Import_Date date;begin        Import_date:=to_date('2011-11-01','YYYY-MM-DD');        sp_GetOCNResult_XH(Import_Date);        commit;end;/declare         Import_Date date;begin        Import_date:=to_date('2011-12-01','YYYY-MM-DD');        sp_GetOCNResult_XH(Import_Date);        commit;end;/declare         Import_Date date;begin        Import_date:=to_date('2012-01-01','YYYY-MM-DD');        sp_GetOCNResult_XH(Import_Date);        commit;end;/declare         Import_Date date;begin        Import_date:=to_date('2012-02-01','YYYY-MM-DD');        sp_GetOCNResult_XH(Import_Date);        commit;end;/declare         Import_Date date;begin        Import_date:=to_date('2012-03-01','YYYY-MM-DD');        sp_GetOCNResult_XH(Import_Date);        commit;end;

请教为什么:
在SQL Plus里面 ,最后一个存储过程为什么耗时是平时的好几倍?

[解决办法]
探讨

引用:

??奇怪哈。你怎么看的执行时间?
执行多次,每次都是最后一个慢很多么?

呵呵
刚刚用sys看了下,
发现时最后一个没有执行,
少了一个‘/'符号

[解决办法]
这种问题,很难让人回答的。
首先就要把环境说清楚,还要给出提出问题的依据。 这些能解释清楚,就不是一句两句了,你问我答 + 补充的,估计能翻上好几页。
再加上影响的因素有很多,一个一个定位,也是相当麻烦的。 不是耐心的人,不会跟进。
[解决办法]
SQL code
修改下lz的代码:begindeclare         Import_Date int;        commit;        set Import_Date = 201104[code=SQL]
[解决办法]
SQL code
修改下lz的代码:begindeclare         Import_Date int;        commit;        set Import_Date = 201104  while Import_Date<20111201 loop  sp_GetOCNResult_XH(Import_Date);---接收参数存储过程接收字符类型  set Import_Date = Import_Date+100;  end loop;  set Import_Date = 20120101  while Import_Date<20120301 loop  sp_GetOCNResult_XH(Import_Date);---接收参数存储过程接收字符类型  set Import_Date = Import_Date+100;  end loop;end; 

读书人网 >oracle

热点推荐