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里面 ,最后一个存储过程为什么耗时是平时的好几倍?

解决方案 »

  1.   

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

  2.   


    修改下lz的代码:
    begin
    declare 
            Import_Date int;
            commit;
            set Import_Date = 201104[code=SQL]01
            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;
    [/code]
      

  3.   


    修改下lz的代码:
    begin
    declare 
            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;